
Hi @Mr.MJ
Welcome to Q&A forum ~
Please note, "office-excel-itpro" tag focues more on general issue, for issues related to VBA code, it's best wait to the VBA experts' suggestions.
According to the same thread "Delete a sheet on closing the workbook", I suggest you try following code. (Please Note: Since the web site is not hosted by Microsoft, the link may changed without notice. Microsoft does not guarantee the accuracy of this information.)
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim sht As Worksheet
Application.DisplayAlerts = False
For Each sht In Sheets
If sht.Name Like "*.delete" Then
sht.Delete
End If
Next sht
ThisWorkbook.Save
Application.DisplayAlerts = True
End Sub
Hope the information could be helpful.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.