![]() |
Checking if a worksheet already exists...
I want to check if a worksheet already exists based on its tab name
(for example, "Test"). If it exists, I want to delete it, then add a blank worksheet with the same name. Is there a simple way of doing this? Thanks! JR |
Checking if a worksheet already exists...
Hi
you may try something like the following sub foo() dim wks as worksheet on error resume next set wks = activeworkbook.worksheets("Test") on error goto 0 if not wks is nothing then application.displayalerts=false wks.delete application.displayalerts=True end if 'insert your new sheet end sub -- Regards Frank Kabel Frankfurt, Germany JR wrote: I want to check if a worksheet already exists based on its tab name (for example, "Test"). If it exists, I want to delete it, then add a blank worksheet with the same name. Is there a simple way of doing this? Thanks! JR |
All times are GMT +1. The time now is 10:31 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com