View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default Best position in VBA code line for

Purely as a guess (I have not benchmarked which is more efficient if at all)
I would say

myRange = wks.Range("A2:F100").SpecialCells(xlCellTypeVisibl e).Resize(, 1)

would be more efficient. Specials cells will have more overhead associated
with it than resize. That being the case I want to execute the specialcells
method on the smaller range and then expand the range at the end. But that is
just idle speculation...
--
HTH...

Jim Thomlinson


" wrote:

2003/2007

Both lines do not fail:

myRange = wks.Range("A2:F100").Resize(, 1).SpecialCells(xlCellTypeVisible)

-OR-

myRange = wks.Range("A2:F100").SpecialCells(xlCellTypeVisibl e).Resize(, 1)

Which is best and a little bit as to why

TIA EagleOne