Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 2-column sort macro


Hi again, you guys were so great at answering my last question that
thought I'd pose another. (That, and I can't for the life of me figur
it out.)

A two-column sort obviously works when done manually, and I can eve
record a working version as a macro- but as soon as you try to run it
it messes up. Here's the code I'm using, please advise:

Range("A13:V19").Select
Selection.Sort Key1:=Range("V13"), Order1:=xlDescending
Key2:=Range( _
"G13"), Order2:=xlDescending, Header:=xlGuess, OrderCustom:=1
MatchCase _
:=False, Orientation:=xlTopToBottom
End Su

--
rmcveig
-----------------------------------------------------------------------
rmcveigh's Profile: http://www.excelforum.com/member.php...fo&userid=3735
View this thread: http://www.excelforum.com/showthread.php?threadid=57219

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 2-column sort macro

Aside from the line wrap problems, the code looks ok to me.

What does "messes up" mean?

rmcveigh wrote:

Hi again, you guys were so great at answering my last question that I
thought I'd pose another. (That, and I can't for the life of me figure
it out.)

A two-column sort obviously works when done manually, and I can even
record a working version as a macro- but as soon as you try to run it,
it messes up. Here's the code I'm using, please advise:

Range("A13:V19").Select
Selection.Sort Key1:=Range("V13"), Order1:=xlDescending,
Key2:=Range( _
"G13"), Order2:=xlDescending, Header:=xlGuess, OrderCustom:=1,
MatchCase _
:=False, Orientation:=xlTopToBottom
End Sub

--
rmcveigh
------------------------------------------------------------------------
rmcveigh's Profile: http://www.excelforum.com/member.php...o&userid=37353
View this thread: http://www.excelforum.com/showthread...hreadid=572198


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 2-column sort macro

The macro looks sound and that approach certainly works.

Possibly you have a data problem.

Define messes up.

--
Regards,
Tom Ogilvy


"rmcveigh" wrote:


Hi again, you guys were so great at answering my last question that I
thought I'd pose another. (That, and I can't for the life of me figure
it out.)

A two-column sort obviously works when done manually, and I can even
record a working version as a macro- but as soon as you try to run it,
it messes up. Here's the code I'm using, please advise:

Range("A13:V19").Select
Selection.Sort Key1:=Range("V13"), Order1:=xlDescending,
Key2:=Range( _
"G13"), Order2:=xlDescending, Header:=xlGuess, OrderCustom:=1,
MatchCase _
:=False, Orientation:=xlTopToBottom
End Sub


--
rmcveigh
------------------------------------------------------------------------
rmcveigh's Profile: http://www.excelforum.com/member.php...o&userid=37353
View this thread: http://www.excelforum.com/showthread...hreadid=572198


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
Use macro to sort column Paula Excel Worksheet Functions 2 August 14th 09 06:59 PM
Auto-Sort Won't Sort All Column Cells TikiTembo Excel Discussion (Misc queries) 1 March 25th 08 07:00 PM
Macro To Sort By Column Header Names Derek Hart Excel Worksheet Functions 6 December 26th 07 09:41 PM
data, sort option is grayed. how to sort on a column? Steve Richter Excel Discussion (Misc queries) 1 September 25th 07 03:25 PM
Can someone give me a simple macro to sort a column? Dan Orth Excel Programming 4 December 11th 04 06:39 PM


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

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

About Us

"It's about Microsoft Excel"