Type mismatch?
And if you have chartsheets (or other non-worksheets), you'd want to use:
For Each Wsh In ActiveWorkbook.Worksheets
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
|