LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default 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
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
close workbook without saving or promt to save ATVNSHANE Excel Discussion (Misc queries) 3 February 4th 10 03:57 PM
Macros on workbook close and save Ade P Excel Programming 1 May 2nd 05 11:39 AM
On close and before save events. Austin Excel Programming 1 October 5th 04 02:05 PM
Close Workbook without displaying message to Save Vinay[_2_] Excel Programming 2 June 10th 04 05:05 PM
Events for workbook close Aaron Queenan Excel Programming 6 July 15th 03 09:09 PM


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

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"