![]() |
If sheet exists, delete
Hi there, I have an array of sheets, and which ever ones are visible I would like it to be deleted, if not do nothing.. So for eg if Master_D and Master are visible then delete them (curretnly VB is getting stuck cause its trying to delete Master, and it isnt visible... Sheets(Array "Master_D", "Master_A", "Master").Activate ActiveWindow.SelectedSheets.Delete Thanks!!! D *** Sent via Developersdex http://www.developersdex.com *** |
If sheet exists, delete
dim myNames as variant
dim iCtr as long mynames = Array("Master_D", "Master_A", "Master") on error resume next 'in case it doesn't exist application.displayalerts = false for ictr = lbound(mynames) to ubound(mynames) sheets(mynames(ictr)).delete next ictr application.displayalerts = true on error goto 0 Darin Kramer wrote: Hi there, I have an array of sheets, and which ever ones are visible I would like it to be deleted, if not do nothing.. So for eg if Master_D and Master are visible then delete them (curretnly VB is getting stuck cause its trying to delete Master, and it isnt visible... Sheets(Array "Master_D", "Master_A", "Master").Activate ActiveWindow.SelectedSheets.Delete Thanks!!! D *** Sent via Developersdex http://www.developersdex.com *** -- Dave Peterson |
If sheet exists, delete
|
All times are GMT +1. The time now is 04:13 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com