ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sorting code problems (https://www.excelbanter.com/excel-programming/311314-sorting-code-problems.html)

DKY[_10_]

sorting code problems
 

I try this code to sort my sheet but end up losing my header (which i
row 1) Can anyone help me figure out why?


Code
-------------------
Rows("1:61775").Select
Range("C1").Activate
Selection.sort Key1:=Range("C1"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

-------------------

--
DK
-----------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...fo&userid=1451
View this thread: http://www.excelforum.com/showthread.php?threadid=26315


Tom Ogilvy

sorting code problems
 
Change xlGuess to xlYes

Rows("1:61775").Select
Range("C1").Activate
Selection.sort Key1:=Range("C1"), Order1:=xlAscending, Header:= _
xlYes, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

--
Regards,
Tom Ogilvy

"DKY" wrote in message
...

I try this code to sort my sheet but end up losing my header (which is
row 1) Can anyone help me figure out why?


Code:
--------------------
Rows("1:61775").Select
Range("C1").Activate
Selection.sort Key1:=Range("C1"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

--------------------


--
DKY
------------------------------------------------------------------------
DKY's Profile:

http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=263154




Jean-Yves[_2_]

sorting code problems
 
Hi,
Read the sort parameters, Header =: xlGuess. ( and check the sort
parameters in Help)
Excell did a wrong guess. Change it to xlYes
Regards,

JY


"DKY" wrote in message
...

I try this code to sort my sheet but end up losing my header (which is
row 1) Can anyone help me figure out why?


Code:
--------------------
Rows("1:61775").Select
Range("C1").Activate
Selection.sort Key1:=Range("C1"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

--------------------


--
DKY
------------------------------------------------------------------------
DKY's Profile:

http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=263154





All times are GMT +1. The time now is 05:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com