I have a workbook that contains several worksheets, one of which is
named HQ. I have macros set up to save the file as-is then again
with just the Summary worksheet. The file has a workbook open event
that points to cell A1 of the HQ worksheet. The problem is is that
the HQ is deleted at the end of the process which means when I pull
the resulting Summary file up (open it), it errors out because it's
looking for the HQ worksheet.
Is there anyway to disable the workbook event when the user hits the
Finish button ~or~ add code to the workbook event that
says if there's no HQ worksheet then disregard? What's the best
approach and how do I set that up?
Here's the code for the Finish button:
Sub Finish()
Application.ScreenUpdating = False
MsgBox "You will be prompted to save the file
twice - once as is, once for just the Summary
worksheet"
Call GetSummaryTitle
Call SaveIt '1st save (as-is, with the detail)
Call PrepareSummary
Call DeleteWorksheets
Call SaveIt '2nd save (just the Summary worksheet)
Application.ScreenUpdating = True
End Sub
***
Here's the open event code:
Private Sub Workbook_Open()
aaHQ.Activate
Range("a1").Activate
End Sub