VBAProIWish
Well-known Member
- Joined
- Jul 6, 2009
- Messages
- 1,027
- Office Version
- 365
- Platform
- Windows
Hello All,
I have this code below that looks to the active worksheet and then deletes the worksheet if cell A2 is blank but it is only for the active worksheet and I want the code below to look at every sheet in the workbook and do the same thing. The workbook is a dynamic one so the names and number of worksheets can be different every time I run the code.
In other words, I need code that looks at cell A2 in every worksheet and deletes whichever worksheets have a blank value.
Thanks much!
I have this code below that looks to the active worksheet and then deletes the worksheet if cell A2 is blank but it is only for the active worksheet and I want the code below to look at every sheet in the workbook and do the same thing. The workbook is a dynamic one so the names and number of worksheets can be different every time I run the code.
In other words, I need code that looks at cell A2 in every worksheet and deletes whichever worksheets have a blank value.
VBA Code:'Sub delete_WSS_with_no_data() Application.DisplayAlerts = False If IsEmpty(Range("A2").Value) = True Then ActiveSheet.delete End If Application.DisplayAlerts = True 'End Sub
Thanks much!