I have a workbook with 5 worksheets Sheet1, Sheet2, Sheet3, Sheet4, Sheet5.
When cell C16 on Sheet1 states "YES" I would like Sheets Sheet2, Sheet3, Sheet4, Sheet5 to be deleted from the Workbook.
Please help with the VBA Code for this.
Thanks!
I have a workbook with 5 worksheets Sheet1, Sheet2, Sheet3, Sheet4, Sheet5.
When cell C16 on Sheet1 states "YES" I would like Sheets Sheet2, Sheet3, Sheet4, Sheet5 to be deleted from the Workbook.
Please help with the VBA Code for this.
Thanks!
Hi, lhickerson,
maybe try
Ciao,![]()
Please Login or Register to view this content.
Holger
Use Code-Tags for showing your code: [code] Your Code here [/code]
Please mark your question Solved if there has been offered a solution that works fine for you
in Sheet1 Module
![]()
Please Login or Register to view this content.
Thanks for the quick response. OK - now I have more sheets to delete (lets say Sheet6 thru Sheet 20) but when I put the names in the line "If Target.Value = "YES" Then Sheets(Array("Sheet2", "Sheet3", "Sheet4", "Sheet5")).Delete" the code overruns to the next line of code. This causes and error. How do I fix this?
maybe so
![]()
Please Login or Register to view this content.
Hi, lhickerson,
delete all other sheets?
Ciao,![]()
Please Login or Register to view this content.
Holger
The sheet names are not actually Sheet6, Sheet7, etc. They are named sheets all with different names with no particular relation.
Sheet names:
Sheets(Array("Sealed Bid Invite", "Sub Bid Form (GMP)", "Bid Recording Sheet", "Rip and Read", "Cover Letter (GMP)", "TOC (GMP)", "Cost Summary (GMP)", "3A Pages ", "Summary of Allowances (GMP)", "Summary of Unbought Allow (GMP)", "
", "Alt Breakdown (GMP)", "CO-PCO Runsheet (GMP)", "CO-PCO Summary (GMP)","CO Breakdown (GMP)","AL Summary TOC (GMP)","Sub Scope Summary TOC (GMP)")).Delete
Help!
I had a error in the code above - I hit "enter" in the middle - my mistake. I fixed it but the code didn't work. I am supposed to copy this code into the "Sheet1" tab in VBA right?
try Sheets(i).Delete instead of Sheets("Sheet" & i).Delete
The code is working - thanks very much for your help!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks