LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 331
Default Checking if the sheet already exists

Hi,

I have the following code now, Is there a more efficient way to do this ?

For Each sh In ActiveWorkbook.Sheets
counter = 0
If sh.Name = "Singles" Then
MsgBox ("Sheet 'Singles' already exists")
counter = 1
End If
Next

If counter = 0 Then
Set sh = Sheets.Add
sh.Name = "Singles"
End If


Thank you,
--
______
Regards,
Greg
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking to see if a file exists. JHB Excel Discussion (Misc queries) 3 August 5th 09 03:11 PM
Checking if Sheet Exists? [email protected] Excel Discussion (Misc queries) 5 September 1st 06 03:27 PM
checking if an url exists Aldo[_2_] Excel Programming 2 October 9th 05 10:20 PM
Checking to see if a worksheet exists Raman325[_27_] Excel Programming 7 August 19th 05 06:36 PM
Checking if a worksheet already exists... JR[_5_] Excel Programming 1 July 14th 04 09:31 PM


All times are GMT +1. The time now is 06:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"