ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Sorting hidden columns (https://www.excelbanter.com/excel-discussion-misc-queries/150972-sorting-hidden-columns.html)

Alex.W

Sorting hidden columns
 
How do I sort hidden columns, say columns B & C along with non-hidden columns
A & D?
Alex.W

OssieMac

Sorting hidden columns
 
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


Alex.W

Sorting hidden columns
 
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


OssieMac

Sorting hidden columns
 
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


Alex.W

Sorting hidden columns
 
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


OssieMac

Sorting hidden columns
 
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


Alex.W

Sorting hidden columns
 
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



All times are GMT +1. The time now is 03:37 AM.

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