Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks OssieMac, I will give it a try.
Alex.W "OssieMac" wrote: I can definitely sort hidden columns if the columns are included in the range to be sorted. Hidden rows do not work. Used the following code in both xl2002 and xl2007. Sheets("Sheet1").Activate 'Insert a worksheet name for the range to be sorted Range("E3:AP5003").Select ActiveWorkbook.Names.Add Name:="SORT_RANGE", RefersToR1C1:=Selection Range("SORT_RANGE").Select 'Goto also works 'I prefer to be specific with things like header = xlYes or xlNo. 'I don't like the xlGuess in macros. (I guess I don't trust it.) 'Note: Whether xlYes or xlNo, Sort Key is still first Data cell never the 'header cell. Selection.Sort Key1:=Range("AL4"), Order1:=xlAscending, Header:=xlYes, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal, Visible:=True Range("D4").Select Regards, OssieMac "Alex.W" wrote: Thanks again Ossiemac. Here is the code. Range("E3:AP5003").AdvancedFilter Action:=xlFilterInPlace, Unique:=False Application.Goto Reference:="SORT_RANGE" Selection.Sort Key1:=Range("AL4"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal Range("D4").Select Alex.W "OssieMac" wrote: I tested my answer with hidden columns with both xl2002 and xl2007 in the interactive mode and it certainly works there. I didn't test hidden rows. However, can you post the macro code that does not work and if I can't answer your query then someone else might. Regards, OssieMac "Alex.W" wrote: Thanks OssieMac I was of the understanding that hidden rows/columns did not sort with the sort command. I have a macro that works fine when the columns are not hidden. It does not work when columns are hidden. Alex.W "OssieMac" wrote: Simply make sure that the hidden columns are included in the selection that you want to sort. I usually just click on the row identifier 1 at the left of the sheet so that the entire row is highlighted and drag down to include all rows to be sorted. Alternatively click on the row identifier 1 and then scroll down to the last required row to be sorted and hold the shift key down and then click on the last row. Regards, OssieMac "Alex.W" wrote: How do I sort hidden columns, say columns B & C along with non-hidden columns A & D? Alex.W |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
can no longer insert new columns & unhide hidden columns | Excel Worksheet Functions | |||
Sorting and Hidden Rows | Excel Worksheet Functions | |||
Hidden Columns No Longer Hidden after Copying Worksheet? | Excel Discussion (Misc queries) | |||
Need to sum columns, excluding hidden columns. | Excel Discussion (Misc queries) | |||
How to keep hidden columns hidden using protection | Excel Discussion (Misc queries) |