ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sort across a single row (https://www.excelbanter.com/excel-programming/359964-sort-across-single-row.html)

Scott P

Sort across a single row
 
Hi,

Is it possible to use the Sort method in Excel VBA to sort values contained
in a single row? If so, how? I tried this by declaring a range (which
represents cells in a single row) and the applying the sort method to this
range and this does not work.

I know this works for sorting columns, but I want to sort left to right
across a row. Any assistance is appreciated.

Tom Ogilvy

Sort across a single row
 
select the row and do Data=Sort, in the sort dialog, click the options
button and choose left to right.

If you need a macro, turn on the macro recorder while you do it manually.

--
Regards,
Tom Ogilvy


"Scott P" wrote:

Hi,

Is it possible to use the Sort method in Excel VBA to sort values contained
in a single row? If so, how? I tried this by declaring a range (which
represents cells in a single row) and the applying the sort method to this
range and this does not work.

I know this works for sorting columns, but I want to sort left to right
across a row. Any assistance is appreciated.


Scott P

Sort across a single row
 
Thank you very much, Tom. This is a big help.

"Tom Ogilvy" wrote:

select the row and do Data=Sort, in the sort dialog, click the options
button and choose left to right.

If you need a macro, turn on the macro recorder while you do it manually.

--
Regards,
Tom Ogilvy


"Scott P" wrote:

Hi,

Is it possible to use the Sort method in Excel VBA to sort values contained
in a single row? If so, how? I tried this by declaring a range (which
represents cells in a single row) and the applying the sort method to this
range and this does not work.

I know this works for sorting columns, but I want to sort left to right
across a row. Any assistance is appreciated.



All times are GMT +1. The time now is 10:54 PM.

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