Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / September 2007

Tip: Looking for answers? Try searching our database.

How can I lock the header cell so it's not alphabetized?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
TanaMary - 25 Sep 2007 18:02 GMT
I have a string (thanks to JW) to auto alphabetize column A in my
worksheet.... however...it's including the title cell.  How can I adjust that
so it only alphabetizes from cell A2 through the rest of the worksheet.......

I SOOOOO need to take computer classes!!!!
Matthew Pfluger - 25 Sep 2007 18:18 GMT
This line of code will sort the entire first column while leaving the header
row as it is.

Range("a:a").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlYes

This command will not affect data in adjacent columns.  If you wish to sort
column a with other data, you should change the Range("a:a") part to
something that matches your range (like Range("a:e") or something).

HTH,
Matthew Pfluger

> I have a string (thanks to JW) to auto alphabetize column A in my
> worksheet.... however...it's including the title cell.  How can I adjust that
> so it only alphabetizes from cell A2 through the rest of the worksheet.......
>
> I SOOOOO need to take computer classes!!!!
TanaMary - 25 Sep 2007 18:26 GMT
Thanks Matthew.  I also discovered there is a field in the General Tab under
Options that allows you to "ignore other applications" in specific cells.  
That worked fine.  Rather than mess with the string, I leave it at that.

BUT, I've copied your suggestion to keep with the original string for future
reference.

> This line of code will sort the entire first column while leaving the header
> row as it is.
[quoted text clipped - 13 lines]
> >
> > I SOOOOO need to take computer classes!!!!
Gord Dibben - 25 Sep 2007 19:19 GMT
This option does not ignore other applications in specific cells so I don't know
how that could possibly help you.

From help...............

In Excel, click Options on the Tools menu, and then click the General tab.
Clear the Ignore other applications check box.
If this option is selected, Excel ignores requests from programs that link to
Excel data by means of DDE rather than OLE.

Gord Dibben  MS Excel MVP

>Thanks Matthew.  I also discovered there is a field in the General Tab under
>Options that allows you to "ignore other applications" in specific cells.  
>That worked fine.  Rather than mess with the string, I leave it at that.
Carlos - 25 Sep 2007 19:24 GMT
Before sorting, you must be sure that the table is properly formatted. If,
for instance, you have something like:

Some Mexican Stocks               
A Date               
Mark    CoTicker    CoName    PriceHi    PriceLow
1    VTO    Vitro    7    5
2    GELEF    Elektra    15    6
3    TMX    TELMEX    10    2

All attempts to sort the data will fail, because it is not clear which cells
form the table you want to sort. Although Excel functions have error-handlers
routines that can solve the error or ambiguity, it is better to state things
clearly. In your example, the error-handler is trying to solve the error by
including the title cell.

In my example, there must be an EMPTY row between the title of the table and
the data.

Some Mexican Stocks               
A Date               
               
Mark    CoTicker    CoName    PriceHi    PriceLow
1    VTO    Vitro    7    5
2    GELEF    Elektra    15    6
3    TMX    TELMEX    10    2

As a general comment, I think it is better to state things clearly than
state them in a confusing way (either for others or for the machine), and
then fix them with another routine. By adding an extra routine or extra code
the whole task becomes more complex.
Signature

Carlos

> I have a string (thanks to JW) to auto alphabetize column A in my
> worksheet.... however...it's including the title cell.  How can I adjust that
> so it only alphabetizes from cell A2 through the rest of the worksheet.......
>
> I SOOOOO need to take computer classes!!!!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.