hi,
just see if it helps you
Sub Button1_Click()
Dim name As String
If Not SheetExists("Missing Date") Then
MsgBox "Sheet: Missing Date doesn't exist!", vbOKOnly + vbCritical, "oops!"
Else
Sheets("Missing Date").Activate
name = InputBox("Please Enter the Name of the Worksheet as dd-mmm-yyyy")
ActiveSheet.name = name
'Range("A1").Value = name
End If
End Sub
Function SheetExists(SheetName As String) As Boolean
' returns TRUE if the sheet exists in the active workbook
SheetExists = False
On Error GoTo NoSuchSheet
If Len(Sheets(SheetName).name) > 0 Then
SheetExists = True
Exit Function
End If
NoSuchSheet:
End Function
Bookmarks