Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Worksheet exists

Is there an easy way to find out if a sheet with a particular name already
exists in a workbook?

Thanks, Kaval
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Worksheet exists

One way:

Const sNAME As String = "ParticularName"
Dim ws As Worksheet
On Error Resume Next
Set ws = Worksheets(sNAME)
On Error GoTo 0
If Not ws Is Nothing Then
MsgBox "Worksheet " & sNAME & " exists"
Else
MsgBox "Worksheet " & sNAME & " doesn't exist"
End If

In article ,
"Kaval" wrote:

Is there an easy way to find out if a sheet with a particular name already
exists in a workbook?

Thanks, Kaval

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Worksheet exists

On Error Resume Next
Sheets("MySheet").Select
If Err Then
MsgBox "MySheet does not exist"
End If
On Error GoTo 0


"Kaval" wrote in message
...
Is there an easy way to find out if a sheet with a particular name already
exists in a workbook?

Thanks, Kaval



Reply
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
Create Worksheet BUT If It Already Exists... Dave Excel Discussion (Misc queries) 2 October 30th 07 11:13 PM
Check if a worksheet exists Mort_Komabt Excel Programming 4 November 28th 05 12:38 AM
How to check if a worksheet exists in worksheet collection Raghunandan Excel Programming 2 July 19th 04 06:55 AM
Worksheet Exists... James Weaver Excel Programming 3 October 6th 03 02:56 PM
How can I tell if a worksheet exists? Robert Stober Excel Programming 5 October 3rd 03 01:00 AM


All times are GMT +1. The time now is 07:14 PM.

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

About Us

"It's about Microsoft Excel"