J
John
I have a workbook that's a template file. The code below works fine
when the file is opened as the (original) template, but when it's
opened as file (template copy) it crashes excel.
This code is contained in a worksheet's on Combo Change event:
Private Sub cboBuildReport_Change()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
Select Case Sheet9.cboBuildReport.Value
Case "Complete"
Sheet1.Delete
Sheet2.Delete
Sheet3.Delete
Sheet4.Delete
Sheet5.Delete
Sheet6.Delete
Sheet7.Delete
Sheet8.Delete
Sheet9.Delete
'Sheet10.Delete
'Sheet11.Delete
Sheet12.Delete
Case "Actual"
'Sheet1.Delete
'Sheet2.Delete
Sheet3.Delete
Sheet4.Delete
Sheet5.Delete
Sheet6.Delete
Sheet7.Delete
Sheet8.Delete
Sheet9.Delete
Sheet10.Delete
Sheet11.Delete
Sheet12.Delete
End Select
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Any ideas? I'm thinking it has something to do with the file being a
template, but I'm not sure how this affects the code...
when the file is opened as the (original) template, but when it's
opened as file (template copy) it crashes excel.
This code is contained in a worksheet's on Combo Change event:
Private Sub cboBuildReport_Change()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
On Error Resume Next
Select Case Sheet9.cboBuildReport.Value
Case "Complete"
Sheet1.Delete
Sheet2.Delete
Sheet3.Delete
Sheet4.Delete
Sheet5.Delete
Sheet6.Delete
Sheet7.Delete
Sheet8.Delete
Sheet9.Delete
'Sheet10.Delete
'Sheet11.Delete
Sheet12.Delete
Case "Actual"
'Sheet1.Delete
'Sheet2.Delete
Sheet3.Delete
Sheet4.Delete
Sheet5.Delete
Sheet6.Delete
Sheet7.Delete
Sheet8.Delete
Sheet9.Delete
Sheet10.Delete
Sheet11.Delete
Sheet12.Delete
End Select
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Any ideas? I'm thinking it has something to do with the file being a
template, but I'm not sure how this affects the code...