Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dow Dow is offline
external usenet poster
 
Posts: 31
Default Set the Header Row

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Set the Header Row

Sorting is done by the specified column.
In your case column C.
Using xlYes for the header option means that the first row
of the data will be Excluded from the sort.
Using the xlNo option Includes the first row in the sort.

I never rely on the xlGuess option.
--
Jim Cone
Portland, Oregon USA
(Special Sort Excel add-in; two dozen additional ways to sort)




"Dow"
wrote in message
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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
Dow Dow is offline
external usenet poster
 
Posts: 31
Default Set the Header Row

I understand that, and I will definitely keep it in mind for my
projects. The issue I am having though is that I want to be able to
make the second row my header and exclude it from my sort. xlguess,
xlno, and xlyes do not allow me to do that.

Any thoughts on how to make that happen?

Thanks again,

Dow.

On Feb 26, 10:18*pm, "Jim Cone" wrote:
Sorting is done by the specified column.
In your case column C.
Using xlYes for the header option means that the first row
of the data will be Excluded from the sort.
Using the xlNo option Includes the first row in the sort.

I never rely on the xlGuess option.
--
Jim Cone
Portland, Oregon *USA
(Special Sort Excel add-in; two dozen additional ways to sort)


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Set the Header Row

So, if you have Rows 1 thru Rows 10 to sort...
Are you saying that you want to sort Rows 1 and Rows 3 to 10
and that row 2 should remain in place as the second row?

Sorting doesn't work that way. It sorts all specified rows -
except for the first row - if you tell Excel that it is a header row.
--
Jim Cone
Portland, Oregon USA



"Dow"
wrote in message
I understand that, and I will definitely keep it in mind for my
projects. The issue I am having though is that I want to be able to
make the second row my header and exclude it from my sort. xlguess,
xlno, and xlyes do not allow me to do that.

Any thoughts on how to make that happen?
Thanks again,
Dow.



On Feb 26, 10:18 pm, "Jim Cone"
wrote:
Sorting is done by the specified column.
In your case column C.
Using xlYes for the header option means that the first row
of the data will be Excluded from the sort.
Using the xlNo option Includes the first row in the sort.

I never rely on the xlGuess option.
--
Jim Cone
Portland, Oregon USA
(Special Sort Excel add-in; two dozen additional ways to sort)


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Omit header from first page without embedding header in code ibvalentine Excel Worksheet Functions 6 August 28th 07 05:10 AM
ListBox with header row, delete row, protect header row mikeolson Excel Programming 2 March 12th 07 02:59 AM
Excel-Header-My Company Name won't work in Header (AT&T) & Time June K Excel Discussion (Misc queries) 2 April 10th 06 08:36 PM
Excel: custom header - is it possible to paste into header? Maureen D. Excel Worksheet Functions 0 November 4th 05 03:07 PM
how do I permanetly add custom header to excel header list? GARY Excel Discussion (Misc queries) 1 December 15th 04 08:52 PM


All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"