Hi guys,
I am trying to test if a worksheet exists (VBA - Excel) but I cannot seem to catch the error. It always will give a runtime error and I need a sure way to test if the worksheet exists so I can exit the Sub and display a helpful msg. Here is the code,a nd would appreciate some help:
I am trying to test if a worksheet exists (VBA - Excel) but I cannot seem to catch the error. It always will give a runtime error and I need a sure way to test if the worksheet exists so I can exit the Sub and display a helpful msg. Here is the code,a nd would appreciate some help:
Code:
If IsError(Application.Workbooks(RODocList.Value).Sheets("1")) Then
Exit Sub
MsgBox ("Workbook not found. Please make sure you have selected the correct workbook")
End If
Comment