View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Executor Executor is offline
external usenet poster
 
Posts: 74
Default Checking to see a sheet of the same name exsists

Hi Dave,

Add this code to the beginning of Private Sub cmdNewSheet_Click()
--------------
Dim sht As Worksheet
Dim str As String

str = Me.tbDate.Value
For Each sht In ThisWorkbook.Worksheets
If sht.Name = str Then
MsgBox "A sheet with this name already exists", vbOKOnly +
vbExclamation, str
Exit Sub
End If
Next
------------------
This will loop thru all the existing sheets and checkes there names.


Hoop This Helps,


Executor