ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Sorting a Range (https://www.excelbanter.com/excel-discussion-misc-queries/96972-sorting-range.html)

cmm

Sorting a Range
 
Hi,

I have a range of cells that starts from column A to Q over mutiple
rows. I tried a macro to sort the range but am constantly failing. I
recorded the manual action of highlighting the required rows, choosing
the sort columns (3) and then sorting (including header) but this is
failing. What I added in the macro is code to choose the last row (so
that when new rows are added the sort will include them dynamically.
Does anyone have a solution for this. I want to have a range with
headers and sort on 3 rows. Column A is sometimes emtpy, but I am only
sorting on EFG (which are always populated).

Thanks and regards

Cedric


Dave Peterson

Sorting a Range
 
Maybe you can find something in the sample code at Debra Dalgleish's site:
http://contextures.com/xlSort02.html


cmm wrote:

Hi,

I have a range of cells that starts from column A to Q over mutiple
rows. I tried a macro to sort the range but am constantly failing. I
recorded the manual action of highlighting the required rows, choosing
the sort columns (3) and then sorting (including header) but this is
failing. What I added in the macro is code to choose the last row (so
that when new rows are added the sort will include them dynamically.
Does anyone have a solution for this. I want to have a range with
headers and sort on 3 rows. Column A is sometimes emtpy, but I am only
sorting on EFG (which are always populated).

Thanks and regards

Cedric


--

Dave Peterson


All times are GMT +1. The time now is 04:51 PM.

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