PDA

View Full Version : Solved: Hidden sheets



av8tordude
03-04-2012, 10:43 PM
I have one (1) sheet that is xlSheetVeryHidden and the other sheets are xlSheetHidden. At the moment, only one sheet is xlSheetVisible. After making a copy of the only visible sheet, I want to hide the old sheet. The code below accomplishes this task, EXCEPT, it converts the 1-xlSheetVeryHidden to xlSheetHidden. Since the other sheets are already hidden, how can I just hide the old visible sheet I just copied?

For Each wks In ThisWorkbook.Worksheets
If wks.Visible And wks.Name <> cboYear.Value Then
wks.Visible = 0
End If
Next wks


I tried this code, but it causes it to error...


For Each wks.visible In ThisWorkbook.Worksheets
If wks.Visible And wks.Name <> cboYear.Value Then
wks.Visible = 0
End If
Next wks

av8tordude
03-04-2012, 11:46 PM
I resolved it.

For Each wks In Sheets
If wks.Visible = xlSheetVisible And wks.Name <> cboYear.Value Then
wks.Visible = 0
End If
Next wks