printmedia
asked on
Custom Format uknown number of column headers to mmm-yy Excel 2016 VBA
Hi all.
I'd like to custom format to mmm-yy the column headers starting with H1 and going on to I1, J1, K1, L1 etc. as long as the cells in each column header have data.
I don't know how many columns will be in the spreadsheet beforehand as it is all based on the end users parameters. Sometimes there may be just 2 column headers H1 and I1, other times there might be 30 etc.
Thank you in advance!
I'd like to custom format to mmm-yy the column headers starting with H1 and going on to I1, J1, K1, L1 etc. as long as the cells in each column header have data.
I don't know how many columns will be in the spreadsheet beforehand as it is all based on the end users parameters. Sometimes there may be just 2 column headers H1 and I1, other times there might be 30 etc.
Thank you in advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Shums! And if I wanted to start in column H then can I change the For loop to start at 8?
For i = 8 To LC
If IsDate(Ws.Cells(1, i)) Then
Ws.Cells(1, i).NumberFormat = "mmm-yy"
End If
Next i
Yes Sir that's right
ASKER
Thanks!
Pleased to help
Try below:
Open in new window