Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tushar Mehta wrote:
No reason to abandon the Cells property. Just qualify it. Well, the reason I suggested abandoning it is that the OP said he has difficulty *remembering* to qualify it, so "just qualify it" is not much help. And the fact remains that Set bRng = Worksheets(2).Range("A1") Set aRng = Range(bRng(1,1),bRng(n,1)) is faster than With Worksheets(2) Set aRng = Range(.Cells(1, 1), .Cells(n, 1)) End With After stumbling onto the then undocumented (as far as I could ascertain) direct indexing of a range object variable many years ago, I've never understood why so many people cling to and proliferate the relatively more cumbersome and inefficient Cells property in lieu of it. Alan Beban 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)) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Addin:Setting the range to the Excel.Range object range prop | Excel Worksheet Functions | |||
Declaring as Object rather than Excel.Worksheet | Excel Programming | |||
Range object to Array object conversion | Excel Programming | |||
Range object to Array object conversion | Excel Programming | |||
Range object to Array object conversion | Excel Programming |