Workbook_Close Command

  • Thread starter Thread starter Jan Nademlejnsky
  • Start date Start date
J

Jan Nademlejnsky

I am looking for a code which would restore the spread sheet to "Clean
State" before saving (when it is being saved):

Something like the following which would be automatically trigged when sheet
is saved:

Sub Before_Save ()
OnSave
ActiveSheet.AutoFilterMode = False
Range("A3").Select
end sub

Thanks for your help

Jan
 
Maybe you could use the workbook_beforesave event:

Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
With Worksheets("Sheet1")
.AutoFilterMode = False
Application.Goto reference:=.Range("A1"), scroll:=True
.Range("a3").Select
End With
End Sub


Right click on the excel icon to the left of File on the worksheet menubar and
select view code. Paste that in.

Save you workbook (adjust the name "sheet1" to what you need).
 
Back
Top