Below Code/Example can be used to find if given worksheet exists in Workbook or not.
Macro Code to check if particular Worksheet Exists or Not in Workbook.
Dim mySheet
mySheet = "Sagar"
On Error Resume Next
temp = Worksheets(mySheet ).Name
If Err.Number = 0 Then
MsgBox "Given Sheet Exists "
Else
Err.Clear
MsgBox "Given Sheet Does not Exist"
End If
This is how we can find out whether worksheet exists or not using Macro
Macro Code to check if particular Worksheet Exists or Not in Workbook.
Dim mySheet
mySheet = "Sagar"
On Error Resume Next
temp = Worksheets(mySheet ).Name
If Err.Number = 0 Then
MsgBox "Given Sheet Exists "
Else
Err.Clear
MsgBox "Given Sheet Does not Exist"
End If
This is how we can find out whether worksheet exists or not using Macro
No comments:
Post a Comment