Sorting Problem

bradley7

Board Regular
Joined
Feb 22, 2005
Messages
102
Hi guys,
I'm sorting a spreasheet using column "D" as the key.
In this column, it contain data such as
CS 5.01
CS 6.01
New RElease

When i sort it using the pop-down menu, it work fine, I actually record this BUT what I put into the code of the Macro and it results as CS 5.01 is after CS 6.01

example

CS 6.01
CS 5.01
CS 6.01
CS 6.01
CS 6.02

The CS 5.01 is the only one out of order
SOMETHING WEIRD IS HAPPENING
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
What I have found is that non-visible characters are usually the culprit.

First start by examining the length of the text using =LEN()

If you get anything back but 7, then you have extra spaces either at the front or back of your text.

Using something like this will help you determine what is in the field

=CODE(MID($A$1,COLUMN()-1,1))

The "-1" is because I put the above formula in column B. Without "-1", the formula would have started looking with the 2nd character.

Drag the formula over for how ever many characters there are in the source text.

Keep in mind that spaces should return code 32. If there is another code, then what have in your text is not a space but an unprintable (non-displayable) character.
 
Upvote 0
Alternately, perhaps when you use the pull down menu, you are indicating there is no header row (thus sorting all elements) but in the macro code you indicate there IS a header row (thus freezing the first entry).
 
Upvote 0

Forum statistics

Threads
1,214,650
Messages
6,120,734
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top