Hi I am new to VBA and struggling to get a working code - getting error "sub or function not defined". I basically want to set up validation that there is no worksheet with the same name in the workbook. (the worksheet name is defined from a userform hence the cell reference C2.
Dim stSheetName As String
stSht = Range("C2")
If Not bWorksheetExists(stSht) Then
'Sheet does not exist
'do something
ActiveSheet.Name = Range("C2").Value
Else
'Sheet exists
MsgBox "Details for this product already exist"
End If
End Sub
Bookmarks