Sort Method Questions
Hello,
Tom Ogilvy recently posted some instructions on how to sort information in a spreadsheet with VBA. Since then I’ve done some research and I have a few questions. VBA Help gives the following example: This example sorts the region that contains cell A1 (the active region) on Sheet1, sorting by the data in the first column and automatically using a header row if one exists. The Sort method determines the active region automatically. Worksheets("Sheet1").Range("A1").Sort _ Key1:=Worksheets("Sheet1").Columns("A"), _ Header:=xlGuess My questions a 1) How does the sort method determine the active region automatically? Are there any circumstances under which it is not reliable? 2) What criteria does it use in determining whether or not there is a header? Is that reliable? 3) What other options are there besides xlGuess, which makes me uneasy? Thanks in advance for all your help. - Pikus --- Message posted from http://www.ExcelForum.com/ |
Sort Method Questions
click in your data and do Ctrl+Shift+8
it expands out to the first completely blank column/row or the edge of the sheet. If you have date that contains blank rows or columns, then it is unreliable. It determines if there is a header by seeing if the first row is different from the remainder of the data - so it is a guess. I know making it bold is pretty reliable. Besides xlguess, you can tell it xlYes or xlNo -- Regards, Tom Ogilvy "pikus " wrote in message ... Hello, Tom Ogilvy recently posted some instructions on how to sort information in a spreadsheet with VBA. Since then I've done some research and I have a few questions. VBA Help gives the following example: This example sorts the region that contains cell A1 (the active region) on Sheet1, sorting by the data in the first column and automatically using a header row if one exists. The Sort method determines the active region automatically. Worksheets("Sheet1").Range("A1").Sort _ Key1:=Worksheets("Sheet1").Columns("A"), _ Header:=xlGuess My questions a 1) How does the sort method determine the active region automatically? Are there any circumstances under which it is not reliable? 2) What criteria does it use in determining whether or not there is a header? Is that reliable? 3) What other options are there besides xlGuess, which makes me uneasy? Thanks in advance for all your help. - Pikus --- Message posted from http://www.ExcelForum.com/ |
Sort Method Questions
|
All times are GMT +1. The time now is 07:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com