Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() In Excel 2007, in tracing a problem I was having with a script, I distilled an issue down to the following: --------------------------------------------- Sub Test() For Each Row In Selection ActiveCell.Offset(0, 1).Activate ActiveCell.Offset(1, -1).Activate Next End Sub --------------------------------------------- If I select a 2x2 range of cells, what I expect is that when stepping through the above code, it changes the focus of the selection from (using these as relative references to the selected range) A1 to A2 to B1 to B2 and then exiting the script. However, it does not update the row it thinks it's working on until it goes through it twice. Which means that for a selection that's 2 rows high, it loops 4 times, instead of 2. What am I doing wrong? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Iterate over irregular shaped range problem | Excel Programming | |||
Right click and iterate through selection | Excel Programming | |||
Beginner programmer problem | Excel Programming | |||
Beginner Variable Problem | Excel Programming |