I need to run a loop on only the populated cells in a column of my sheet. I can obtain the last occupied row using this code:
<pre> Set oLastRow = Range("A65536").End(xlUp)
lLastRow = Range("A65536").End(xlUp).Row
lLastRow = lLastRow + 1
I can select the first column in this last row using:
<pre> Range("A" & lLastRow).Select
and I could store this in some variable called MyLastRow and another variable I can use to store the first row.
<pre> MyLastRow = "A" & lLastRow
MyFirstRow = "A1"
So I have enough information to select the first column. I tried
But it doesn't work. How can I use my variables (Strings) in a Range(X:Y) statement?