Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm working with sorting various subsets of data with Excel's
autosort. Because I want the same process done on 4 different worksheets, I currently have an outer For Each loop to cycle through the worksheets and an inner to cycle through the row numbers that I'm dealing with. For Each sh In Collect With sh temp = 2 For Each i In CollectSys .Range("B" & temp & ":AL" & i).Sort key1:= _ .Range("I" & temp & ":I" & i), order1:=xlAscending temp = i + 1 Next End With Next Collect is my worksheets, and CollectSys is my row numbers (7, 13, 16, 21, 26 for this example). About 30% of the time, this works perfectly. That other 70%, it looks like the process cycles through the inner For loop repeatedly, messing with the variables (setting temp higher than the highest row number, instead of resetting to 2). This eventually causes my entire worksheet to sort ascending, instead of each separate group. Any ideas why this loop is so inconsistent? -bgetson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VLOOKUP inconsistent ... help. | Excel Discussion (Misc queries) | |||
inconsistent autofit | Excel Discussion (Misc queries) | |||
Inconsistent Formula? | Excel Discussion (Misc queries) | |||
Calculation inconsistent | Excel Discussion (Misc queries) | |||
3-d referencing inconsistent | Excel Discussion (Misc queries) |