ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Alphabetical sort in a macro (https://www.excelbanter.com/excel-programming/356190-alphabetical-sort-macro.html)

RichardVisteon

Alphabetical sort in a macro
 


tony h[_85_]

Alphabetical sort in a macro
 

need a bit of imagination to answer this on

--
tony
-----------------------------------------------------------------------
tony h's Profile: http://www.excelforum.com/member.php...fo&userid=2107
View this thread: http://www.excelforum.com/showthread.php?threadid=52305


Tom Ogilvy

Alphabetical sort in a macro
 
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...hreadid=523054



RichardVisteon

Alphabetical sort in a macro
 
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...hreadid=523054



nhamilt

Alphabetical sort in a macro
 
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...hreadid=523054



Susan

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 -




All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com