View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default Alphabetical sort in a macro

something like this (UNTESTED):

sub richard()

dim WS as worksheets
dim myLastRow as long
dim myRange as range

for each ws in activeworkbook
mylastrow = ws.cells(10000,1).end(xlup).row
set myrange = ws.range("a1:d" & mylastrow)
myrange.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, Orientation:=xlTopToBottom
next ws
end sub

this sets a range based on columns a - d, using A1 as the sort key.
adjust to suit. hope it gets you started. try recording a macro on
one of the sheets to get the sort options the way you want them, if
these don't work for you (regarding headers & such).
:)
susan





On Jul 25, 10:55*am, nhamilt
wrote:
I still can't figure out how to create a macro that will sort the same
information in the same way on multiple sheets in the entire workbook.
Possibly because I can't figure out how to select the whole workbook.



RichardVisteon" wrote:
*I thought i'd try the hard questions first.


*Thanks Tom.


*Regards


Richard.


"Tom Ogilvy" wrote:


Cells.Sort Key1:=Range("A1")


--
Regards,
Tom Ogilvy


"tony h" wrote:


need a bit of imagination to answer this one


--
tony h
------------------------------------------------------------------------
tony h's Profile:http://www.excelforum.com/member.php...o&userid=21074
View this thread:http://www.excelforum.com/showthread...readid=523054- Hide quoted text -


- Show quoted text -