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
 

Some videos you may like

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

nbrcrunch

Well-known Member
Joined
Jan 1, 2003
Messages
2,062
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.
 

DrShowMe

New Member
Joined
Nov 17, 2005
Messages
8
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).
 

Watch MrExcel Video

Forum statistics

Threads
1,122,976
Messages
5,599,144
Members
414,292
Latest member
kingshuk963

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
Top