I'm trying to test if a Sheet Exists, and if it does exits to do some additional code/work on it. Any reason why the below fails with a 'Subscript out of Range' Error when the sheet in question is missing?
If I change the Sheet name to something that does exists, the code and msgbox returns correctly. But when the sheet being looked for is actually missing it gives the error?
Edit. I think I understand now. This is because it is looking at the ActiveSheet only? And you need to actually loop through the workbook to check if the worksheet exists?![]()
Sub Test() If Not Sheets("Evaluation") Is Nothing Then MsgBox "Sheet Exists" Else MsgBox "Missing" End If End Sub
Bookmarks