PDA

View Full Version : [SOLVED:] Handle with activating of nonexisting sheet



Paleo
02-02-2005, 07:04 PM
Hi,

Is there a way to handdle the error when I command

Sheets("Test").Activate
and there is no sheet called Test?

I would rather a solution that didnt include a for ... each passing through each sheet in the workbook if its possible.

Jacob Hilderbrand
02-02-2005, 07:29 PM
Try this.


Dim WS As Worksheet
On Error Resume Next
Set WS = Sheets("Test")
On Error Goto 0
If WS Is Nothing Then
'No Sheet
Else
'Sheet Exists
End If

Paleo
02-02-2005, 07:43 PM
Hi Jake,

great, worked just fine!

Thanks a lot!

Jacob Hilderbrand
02-02-2005, 07:59 PM
You're Welcome :beerchug:

Take Care