View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Auto Sort Columns on Workbook Open

Are all your users running xl2002 or above?

If no, then this will break for users of older versions. (It was added in
xl2002.)

The sort statement has an optional parm that you can add for each key.

DataOption1:=xlSortNormal
or
DataOption1:=xlSortTextAsNumbers

Just add that to the end of the sort statement.

With myRng
.Cells.Sort key1:=.Columns(2), order1:=xlAscending, _
header:=xlYes, DataOption1:=??????????
End With

But the default value is xlSortNormal. So that range should treat text numbers
and number numbers separately.

I'm not sure what you're asking???


stacy wrote:

Oh wait... One more quick question: When I sort the spreadsheet
manually, I get the window asking me if I want to sort everything that
looks like a number, as a number, which I do want... Some users have
placed things in here that are not picked up and sorted as a number.
Is there a way to build this into the code? Thanks again...


--

Dave Peterson