Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try something like this:
Sub test() Dim rng As Range Dim c As Range Set rng = Range("A1:E5") Set c = Cells(1) c.Select Do While Not Intersect(rng, c.Offset(1, 0)) Is Nothing Set c = c.Offset(1, 0) c.Select Loop End Sub Lookup the Intersect method in the help. RBS "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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Loop question | Excel Discussion (Misc queries) | |||
Loop question | Excel Discussion (Misc queries) | |||
Loop question | Excel Programming | |||
One more loop question | Excel Programming | |||
For loop question | Excel Programming |