I need to find the last column in the sheet and then autofill formats to the right. In other words I need to do this:
Columns("N:N").AutoFill Destination:=Columns("N:O"), Type:=xlFillFormats
replacing the letters "N" and "O" with variables.
I can find the last column easily enough with
LastCol = Range("A1").End(xlToRight).Column
but this returns a number, not a letter. Simply replacing "N" and "O" above with LastCol and LastCol + 1 returns "Aplication-defined or object-defined error"
I'm using the LastCol variable elsewhere in my code, so would prefer to keep it as a number. What I need, then, is the correct syntax for specifying two columns by number rather than letter. I've searched the help file to no avail.
Columns("N:N").AutoFill Destination:=Columns("N:O"), Type:=xlFillFormats
replacing the letters "N" and "O" with variables.
I can find the last column easily enough with
LastCol = Range("A1").End(xlToRight).Column
but this returns a number, not a letter. Simply replacing "N" and "O" above with LastCol and LastCol + 1 returns "Aplication-defined or object-defined error"
I'm using the LastCol variable elsewhere in my code, so would prefer to keep it as a number. What I need, then, is the correct syntax for specifying two columns by number rather than letter. I've searched the help file to no avail.