Sort Method Questions

  • Thread starter Thread starter pikus
  • Start date Start date
P

pikus

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 are:
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top