Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting difficulties 1

Status
Not open for further replies.

DreewToo

Programmer
Dec 20, 1999
128
US
I'm encountering a problem that I thought I never would.

I've used VB6 to create and make adjustments to Excel 2000 workbooks for budgetting purposes. At this point, I've been asked to sort items on the Summary sheet to a specific order. The routine I use to do this works for some sections, and not for others. It seems that certain rows refuse to move from their spot during a sort.

It looks like this:

Acct Name Data SortKey
0000 First 1 4
0002 First 4 2
0003 First 5 3
Total 10
When I select the SortKey(4), that row insists on staying where it is. I've tried moving it to a different group of numbers, and received more odd results. When I place it at the end of a list, it will sort the first time, but once it lands at the top of the list, it won't budge from there.

I'm leaning towards this being a problem caused by a hidden column existing in the range to be sorted, but the behavior repeated itself after I unhid it.

Anyone seen this before?
Drew
 
Yes. Check and make sure the columns contain the same type of data. Remove left/center/right formatting and check that numbers are not entered as text. Excel sorts numbers before text.
 
Thank you for your reply. I wound up looking into the Header switch, which was set to XLGuess because that's how the macro recorded. After checking the docs, it turns out the behavior was reasonable, but Excel's guess was wrong, it thought the first line was a header line.

Problem solved by inserting XLNo instead for the Header piece of the search...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top