jillian728
Active Member
- Joined
- Jun 20, 2003
- Messages
- 250
We are using a macro that looks if ranges w/in sheets are blank and if yes -they are deleted. However, sometimes a user might delete the sheet b4 the macro is run. How can we tweak the macro so that if the sheet is found it is deleted and if not found, it doesn't delete it and doesn't cause an error.
If Application.Evaluate("=MAX(LEN('Sys Matrix'!D5:D62))") = 0 Then
Application.DisplayAlerts = False
Sheets("SYS Matrix").Delete
Application.DisplayAlerts = True
End If
If Application.Evaluate("=MAX(LEN('SW Mtx'!D5:D62))") = 0 Then
Application.DisplayAlerts = False
Sheets("SW Mtx").Delete
Application.DisplayAlerts = True
End If
If Application.Evaluate("=MAX(LEN('Sys Matrix'!D5:D62))") = 0 Then
Application.DisplayAlerts = False
Sheets("SYS Matrix").Delete
Application.DisplayAlerts = True
End If
If Application.Evaluate("=MAX(LEN('SW Mtx'!D5:D62))") = 0 Then
Application.DisplayAlerts = False
Sheets("SW Mtx").Delete
Application.DisplayAlerts = True
End If