Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help on Workbook close and workbook save events
Have written the following code for before close and before save
Private Sub Workbook_BeforeClose(Cancel As Boolean) Range("A13:G512").Select Selection.Sort Key1:=Range("A13"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortTextAsNumbers Range("A13").Select End Sub Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Range("A13:G512").Select Selection.Sort Key1:=Range("A13"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortTextAsNumbers Range("A13").Select End Sub However I am getting a a 1004 error can you help. I feel i am so close but am having no joy. thanks in advance |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
close workbook without saving or promt to save | Excel Discussion (Misc queries) | |||
Macros on workbook close and save | Excel Programming | |||
On close and before save events. | Excel Programming | |||
Close Workbook without displaying message to Save | Excel Programming | |||
Events for workbook close | Excel Programming |