No reason to abandon the Cells property. Just qualify it.
Sub testIt4()
Dim aRng As Range, n As Integer
n = 7
With Worksheets(2)
Set aRng = Range(.Cells(1, 1), .Cells(n, 1))
End With
MsgBox aRng.Parent.Name & "," & aRng.Address
End Sub
or, if using the equivalent of SHIFT+CTRL+down arrow:
With Worksheets(2).Cells(1, 1)
Set aRng = Range(.Item(1), .End(xlDown))
--
Regards,
Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
In article ,
says...
Hi JE
I always forget the worksheet identifier for the cells object :-(
thanks for your correction :-)