View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
libby libby is offline
external usenet poster
 
Posts: 96
Default Help with some code please

Hi try this

Dim sh As Worksheet
For Each sh In Worksheets
If sh.Name = "mysheet" Then
With Worksheets("mysheet")
If Not IsEmpty(.Range("A2").Value) Then
'do stuff
End If
End With
End If
Next sh

libby
-----Original Message-----
I have the following code:

With Worksheets("mysheet")
If Not IsEmpty(.Range("A2").Value) Then
'do stuff
End If
End With

My problem is that mysheet is not always a sheet in the

file. How can I get
Excel to miss out the code above if mysheet does not

exist in the file?

Thanks in advance.

Gareth


.