![]() |
Sorting in VBA
I am doing serveral sorts in a macro. The code was recorded. When I run the
macro it always states that it can not determine which row in my list contains column labels. I have to then click OK for it to assume that I want the first row to be what it sorts by. It there a way around this? -- Regards, Michael |
Sorting in VBA
Hi Michael This is some code that I use in one of my projects, it does an alpha sort. Shd = Sheets("Data") Shd.Range("B5:AZ40").Sort Key1:=Shd.Range("B5"), Order1:=xlAscending HTH Andrew Bourke Michael from Austin wrote: I am doing serveral sorts in a macro. The code was recorded. When I run the macro it always states that it can not determine which row in my list contains column labels. I have to then click OK for it to assume that I want the first row to be what it sorts by. It there a way around this? |
Sorting in VBA
My mistake it is not happening for the sort, it is happening when I am going
to subtotal. The message that is..... "Ajtb" wrote: Hi Michael This is some code that I use in one of my projects, it does an alpha sort. Shd = Sheets("Data") Shd.Range("B5:AZ40").Sort Key1:=Shd.Range("B5"), Order1:=xlAscending HTH Andrew Bourke Michael from Austin wrote: I am doing serveral sorts in a macro. The code was recorded. When I run the macro it always states that it can not determine which row in my list contains column labels. I have to then click OK for it to assume that I want the first row to be what it sorts by. It there a way around this? |
Sorting in VBA
Dunno if this will help, but you may want to re-record the macro and
this time in the sort dialog box ensure you select the 'my data range has header row' option. -- Regards, Tushar Mehta www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article , says... I am doing serveral sorts in a macro. The code was recorded. When I run the macro it always states that it can not determine which row in my list contains column labels. I have to then click OK for it to assume that I want the first row to be what it sorts by. It there a way around this? |
All times are GMT +1. The time now is 01:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com