I have been successfully using the following to retrieve the row number to use for formulas as in the following example
but want to now retreive a column letter. I have adapted the following but when I hover my mouse over the line of code it is coming up with the number 13 rather than M
In the last line of code if I replace the cw with the letter M in quotes the macro works so I think it must be how I have set the Dim statement, but I have tried different options but none seem to help as I keep getting runtime error 1004
I would be really grateful if someone could point out where I am going wrong
Code:
Dim rw As Long
rw = Range("a65536").End(xlUp).row
Range("R2:R" & rw).FormulaR1C1 = "=trim(rc[-17])"
Code:
Dim cw As String
cw = Range("IV1").End(xlToLeft).Column
Range("A1:" & cw & "1").Select
I would be really grateful if someone could point out where I am going wrong