Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Sort Macro for Named Ranges

I rrecorded 2 Sort Macros then I change the Range to reference the Name
Range. The problem is when one Sort command working correctly the other one
blowsup.

is there a way to write I macro that will sort the different named ranges



Range("COAXrefRange").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:
= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal


Range("PropertyXrefRange").Sort Key1:=Range("A2"), Order1:=xlAscending,
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200703/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Sort Macro for Named Ranges

with range("coaxrefrange")
.cells.sort key1:=.columns(1), order1:=xlascending, header:=xlguess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
end with

And repeat it for the second range.

By the way, if you know your range has headers (or doesn't have headers), then
you might as well specify it in your code -- don't let excel guess if you know
what it should be.



"Fredriksson via OfficeKB.com" wrote:

I rrecorded 2 Sort Macros then I change the Range to reference the Name
Range. The problem is when one Sort command working correctly the other one
blowsup.

is there a way to write I macro that will sort the different named ranges


Range("COAXrefRange").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:
= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal


Range("PropertyXrefRange").Sort Key1:=Range("A2"), Order1:=xlAscending,
Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200703/1


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Sort Macro for Named Ranges

Thabk you

Dave Peterson wrote:
with range("coaxrefrange")
.cells.sort key1:=.columns(1), order1:=xlascending, header:=xlguess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
end with

And repeat it for the second range.

By the way, if you know your range has headers (or doesn't have headers), then
you might as well specify it in your code -- don't let excel guess if you know
what it should be.

I rrecorded 2 Sort Macros then I change the Range to reference the Name
Range. The problem is when one Sort command working correctly the other one

[quoted text clipped - 17 lines]
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200703/1



--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200703/1

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
macro to make named ranges Rosencrantz Excel Programming 7 June 6th 06 02:55 PM
Named ranges wont expand after sort?? Simon Lloyd[_665_] Excel Programming 4 December 2nd 05 02:14 AM
Referring to named ranges in a macro Pontificateur Excel Programming 5 September 16th 05 06:23 PM
Macro eliminating named ranges JonR Excel Programming 1 January 18th 05 02:03 AM
Named Ranges - Macro Problems Karl Burrows Excel Programming 2 April 4th 04 06:03 PM


All times are GMT +1. The time now is 07:33 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"