Object Name

  • Thread starter Thread starter halem2
  • Start date Start date
H

halem2

HI:

I'm trying to create a sub that would check for duplicate sheet ta
names and pop up a msg to the user.

Can anyone please tell me what the object name is for the Tab name???


thank
 
Excel doesn't allow duplicate sheet tab names. Are you trying to assess a
proposed name?

Activesheet.Name will give you the sheet tab name.
 
To check if a worksheet name exists, you can use...
'==============================================
Public Function SheetExists(sName) As Boolean
' Returns TRUE if sheet exists in the active workbook
Dim x As Object
On Error Resume Next
Set x = ActiveWorkbook.Sheets(sName)
If Err = 0 Then SheetExists = True _
Else SheetExists = False
End Function
'==============================================

HTH,
Gary Brown
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top