palaeontology
Active Member
- Joined
- May 12, 2017
- Messages
- 444
- Office Version
- 2016
- Platform
- Windows
Hi all,
I've written the following code to delete the sheet called ... Entry (2) .... when exiting the workbook ?
However, it doesn't seem to be deleting the sheet ... when I re-open the workbook, the sheet is still there.
Can anyone see what I've done incorrectly ?
Kind regards,
Chris
I've written the following code to delete the sheet called ... Entry (2) .... when exiting the workbook ?
Code:
Private Sub App_WorkbookBeforeClose(ByVal Wb As Workbook, _Cancel As Boolean)
For Each sht In Sheets
If sht.Name = "Entry (2)" Then
sht.Delete
End If
Next sht
Workbook.Save
End Sub
However, it doesn't seem to be deleting the sheet ... when I re-open the workbook, the sheet is still there.
Can anyone see what I've done incorrectly ?
Kind regards,
Chris