ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I lock the header cell so it's not alphabetized? (https://www.excelbanter.com/excel-programming/398108-how-can-i-lock-header-cell-so-its-not-alphabetized.html)

TanaMary

How can I lock the header cell so it's not alphabetized?
 
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

How can I lock the header cell so it's not alphabetized?
 
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

"TanaMary" wrote:

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

How can I lock the header cell so it's not alphabetized?
 
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.

"Matthew Pfluger" wrote:

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

"TanaMary" wrote:

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!!!!


Gord Dibben

How can I lock the header cell so it's not alphabetized?
 
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



On Tue, 25 Sep 2007 10:26:03 -0700, TanaMary
wrote:

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

How can I lock the header cell so it's not alphabetized?
 
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.
--
Carlos


"TanaMary" wrote:

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!!!!



All times are GMT +1. The time now is 11:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com