Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Brian,
Put the code in the Workbook_Open event macro in ThisWorkbook code module. You should qualify the ranges with the worksheet id. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Brian McGuire" wrote in message ... Hi, I have a macro that sorts through data that I have in a spreadsheet. As it stands now, the macro is run by pressing a command button. I would like the sort to occur automatically every time the workbook is opened. I dont want the macro to run at the startup of every workbook, just the workbook with the data in it. The code as it stands now is: Private Sub CommandButton1_Click() 'Module Sorting Macro '1/17/04 Range("C2").Select Range("A1:P108").Sort Key1:=Range("C2"), Order1:=xlAscending, Header:= _ xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal End Sub Where would I have to put this or how do I need to alter the code to make this sort exceute everytime the workbook opens. Any help is greatly appreciated. Thanks. Brian |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Startup Macro | Excel Discussion (Misc queries) | |||
Running auto correct on startup? | Excel Discussion (Misc queries) | |||
Startup macro | Excel Discussion (Misc queries) | |||
Running macro at startup | Excel Programming | |||
running macro upon a spreadsheet's startup | Excel Programming |