#1   Report Post  
Sorting in macros
 
Posts: n/a
Default sorting with macros

I created a employee schedule and i dont want people adding rows and such to
i locked all cell except for the names of the employees which are list under
column A.
I set up a macros so that all the user has to do is add new employees at the
next availible row and delete any employees that have left. Then press a
macros button and the names list in column A sort in ABC order. The problem
is that when i set the macros it sorts correctly, and then i push the macros
button that i assigned it to and it does nothing. The strange thing is that
it works on other worksheet in the same workbook.
here is the code for the unworking macros.



Sub sortconc()
'
' sortconc Macro
' Macro recorded 1/31/2005 by palace
'

'
Range("A7:A80").Select
Selection.Sort Key1:=Range("A8"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A7").Select
End Sub


and here is the code that works for another sheet


Sub sortbox()
'
' sortbox Macro
' Macro recorded 5/5/2004 by Muvico Employee
'

'
Range("A7:A36").Select
Selection.Sort Key1:=Range("A7"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A7").Select
End Sub


any help would be great.

scott


  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Nothing obvious to me but I suggest you explicitly qualify the worksheet,
such as

Worksheets("Data Sheet").Range(A7:A80").Select

etc.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Sorting in macros" <Sorting in wrote in
message ...
I created a employee schedule and i dont want people adding rows and such

to
i locked all cell except for the names of the employees which are list

under
column A.
I set up a macros so that all the user has to do is add new employees at

the
next availible row and delete any employees that have left. Then press a
macros button and the names list in column A sort in ABC order. The

problem
is that when i set the macros it sorts correctly, and then i push the

macros
button that i assigned it to and it does nothing. The strange thing is

that
it works on other worksheet in the same workbook.
here is the code for the unworking macros.



Sub sortconc()
'
' sortconc Macro
' Macro recorded 1/31/2005 by palace
'

'
Range("A7:A80").Select
Selection.Sort Key1:=Range("A8"), Order1:=xlAscending,

Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A7").Select
End Sub


and here is the code that works for another sheet


Sub sortbox()
'
' sortbox Macro
' Macro recorded 5/5/2004 by Muvico Employee
'

'
Range("A7:A36").Select
Selection.Sort Key1:=Range("A7"), Order1:=xlAscending,

Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Range("A7").Select
End Sub


any help would be great.

scott




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
Books on writing Macros JC Excel Discussion (Misc queries) 1 January 29th 05 11:45 PM
Transferring toolbars and macros to other computers Darrell Excel Discussion (Misc queries) 1 January 19th 05 12:21 AM
The available macros list in XL; how to suppress filename from showing KR Excel Discussion (Misc queries) 1 January 10th 05 07:20 PM
Macros disappear after a file is imported Brent E Excel Discussion (Misc queries) 1 December 18th 04 12:25 AM
sorting question Brian Excel Discussion (Misc queries) 4 November 28th 04 12:30 PM


All times are GMT +1. The time now is 06:44 AM.

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"