Set an Object
Sub UseRangeObject2()
Set rng = Range("M5:M" & Rows.Count.End(xlUp).Row)
End Sub
Change to:
Sub UseRangeObject2()
Set rng = Range("M5:M" & Cells(Rows.Count, 1).End(xlUp).Row)
End Sub
You need a cell reference for the End function to work off of. It won't do
it off of just the rows.count because that returns an integer rather than a
cell reference.
"JMay" wrote in message
...
I'm familiar with setting an Object under UseRangeObject1() (first below)
Sub UseRangeObject1()
Lr = Range("M" & Rows.Count).End(xlUp).Row
Set rng = Range("M5:M" & Lr)
End Sub
But can't one bypass getting the Lr as Follows? Currently no working -
what is wrong with syntax?
Sub UseRangeObject2()
Set rng = Range("M5:M" & Rows.Count.End(xlUp).Row)
End Sub
TIA,
Jim
|