If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > How to check for a sheet in the workbook?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-12-04, 03:21
oks oks is offline
Registered User
 
Join Date: Jun 2004
Location: Singapore
Posts: 28
Question How to check for a sheet in the workbook?

Hi,

How can I check if a sheet is already in the workbook before trying to activate the sheet?

Please help! Thanks...
oks
Reply With Quote
  #2 (permalink)  
Old 07-12-04, 05:32
starsky51 starsky51 is offline
Registered User
 
Join Date: Feb 2002
Posts: 8
The function below should do what you need.
Dave.

Function SheetExists(strSheetName As String) As Boolean
Dim shtTemp As Worksheet
SheetExists = False
For Each shtTemp In ActiveWorkbook.Sheets
If shtTemp.Name = strSheetName Then SheetExists = True
Next shtTemp
End Function
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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