Type mismatch?
What's in G1 of the worksheet that the code blows up on?
If it's an error, then that could be the cause.
If UCase(Wsh.Range("G1").Text) = "HIDE" Then
Is one way to avoid it.
John Wirt wrote:
When I run this code, I get an error="Type mismatch." How come?
Public Sub HideSelectedSheets()
Dim Wsh As Worksheet
For Each Wsh In ActiveWorkbook.Sheets
If UCase(Wsh.Range("G1").Value) = "HIDE" Then
Wsh.Visible = xlSheetHidden
End If
Next
End Sub
Thank you.
John Wirt
--
Dave Peterson
|