LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Inconsistent Sort

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VLOOKUP inconsistent ... help. Wayne Excel Discussion (Misc queries) 2 February 22nd 10 09:07 AM
inconsistent autofit annoni Excel Discussion (Misc queries) 0 March 30th 09 08:24 PM
Inconsistent Formula? andrew Excel Discussion (Misc queries) 6 February 12th 09 05:04 AM
Calculation inconsistent PMBO Excel Discussion (Misc queries) 4 December 2nd 08 04:12 PM
3-d referencing inconsistent duncan79 Excel Discussion (Misc queries) 5 January 25th 06 05:39 PM


All times are GMT +1. The time now is 07:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"