W
Woody1313
Hi
I have some code in the "Thisworkbook"
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim lastsheet As Long
lastsheet = Sheets.Count
For N = 2 To lastsheet
Sheets(N).Visible = False
Next
Me.Save
Me.Close
End Sub
This should hide , save and close the workbook once it has been closed.
Sometimes when the workbook is closed excel does not execute this code
and mearly just ask if you want to save and then just closes the
workbook without hiding the sheets.
Is there something I need to change in my code?
Thanks
John
I have some code in the "Thisworkbook"
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim lastsheet As Long
lastsheet = Sheets.Count
For N = 2 To lastsheet
Sheets(N).Visible = False
Next
Me.Save
Me.Close
End Sub
This should hide , save and close the workbook once it has been closed.
Sometimes when the workbook is closed excel does not execute this code
and mearly just ask if you want to save and then just closes the
workbook without hiding the sheets.
Is there something I need to change in my code?
Thanks
John