Look for a specific worksheet, then...

RaunLGoode

Registered User.
Local time
Today, 00:52
Joined
Feb 18, 2004
Messages
122
I want to verify that a worksheet with a specific name does not already exist prior to creating that worksheet.
Searching through past threads I see that ASAP utilities would probably help do this, but since the people using this spread will not have this add-in I would like to find a way native to Excel.
Is there some to write an IF statement so that if WorkSheets(UniqueName) doesn't exist I can add an new worksheet and rename it to (UniqueName) ?
 
You can loop through the sheets collection to see if there is a match, and if there isn't then you can create it. I would do something similar to:

Code:
For intX = 1 to Sheets.Count
    If Sheets(intx).name = "TESTNAME" Then
        blnFound = True
        Exit For
    End If
Next intX

Then you just check if blnFound is True or not, and you know if it exists.
 
Looks Like what I need

This looks like what I need I will try it first thing tomorrow.
Thx
 

Users who are viewing this thread

Back
Top Bottom