View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default end with loop question

Don't work with the activecell. It is slow and causes the screen to move.

Dim cell as Range
for each cell in Range("O2:M5")


Next

where you would use ActiveCell, use cell.

--
Regards,
Tom Ogilvy


"Lee Hunter" wrote in message
...
WIll the following work correctly?
Dim rng as Range
set rng = Range(o2:M5)
DoThis: with rng
do something until the ActiveCell goes outside "rng"
ActiveCell.offset(1).select
goto DoThis
End With
Gets here when the ActiveCell is outside of "rng"

If not, please suggest a method to control execution while ActiveCell is
within a range.

TIA
Lee Hunter