G
Guest
How do I sort hidden columns, say columns B & C along with non-hidden columns
A & D?
Alex.W
A & D?
Alex.W
OssieMac said: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