Looking for a way to Set Range to Entire Column
On May 22, 1:02*pm, Dan Thompson
wrote:
Here is my code
Sub Temp()
Dim R
'Set ColA = ActiveSheet.Range("A1:A65536")
Set ColA = ActiveSheet.Columns(1).EntireColumn
For Each R In ColA
* * If R.Text = "" Then
* * * * endrow = R.Row - 1
* * * * Exit For
* * End If
Next
MsgBox endrow
End Sub
The first line I have rem'ed out was what I originally was using and it does
work for this code however I was hoping that I could do the same thing by
using just a column reference to set my range for the rest of my code but
when I use the second line after the rem'ed out line it doesn't return the
same as my original line of code. Can I use somthing like the second line of
my code or do I have to use the first one to set my range ?
Dan Thompson
Perhaps I'm overlooking something, but off the top of my head it
appears you're looping thru the entire column from top to bottom
seeking the last used row -- in which case you should be able to save
time/coding by replacing the entire loop with a single line:
sub temp()
endrow = Range("A65536").End(xlUp).End).Row
msgbox endrow
end sub
|