Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default 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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting Values Without Sorting Formulas SBX Excel Discussion (Misc queries) 2 April 12th 09 11:17 PM
Automatic sorting (giving max and min) based on custom sorting lis Joe Lewis[_2_] Excel Worksheet Functions 4 November 23rd 08 05:12 AM
Sorting VLookup vs Sorting SumProduct Lauren Excel Discussion (Misc queries) 1 August 21st 07 12:19 AM
Sorting: Sorting by the First Character dzuy Excel Discussion (Misc queries) 2 June 22nd 06 08:27 PM
Sorting ListBox results or transposing ListBox values to other cells for sorting Rob[_8_] Excel Programming 1 July 9th 03 04:35 AM


All times are GMT +1. The time now is 02:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"