View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Brown[_5_] Gary Brown[_5_] is offline
external usenet poster
 
Posts: 236
Default Set the Header Row

Define your range first...
Range("C2:F10").Select
Selection.Sort Key1:=Range("C3"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal

--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Dow" wrote:

I looked through the forum but did not find an answer.

The header information in my spreadsheet is in row 2.

Excel has 3 options for header row: Yes, No, and Guess. None of these
work on my worksheet to use the second row to sort by.

Selection.Sort Key1:=Range("C2"), Order1:=xlDescending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal

I have a work around that I adapted from Tom Ogilvy:
"Insert a blank row between the last header row and the other header
rows.
Sort normally
Remove the blank row."

I added the code for that and it works fine. It feels like there
should be a way to say "Use Row 2 as Header Row".

Thanks,

Dow.