Macro-Hide & Unhide Sheets with condition
Oops
try this instead, left a line in that didn't work
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
For i = 1 To Worksheets.Count
If Worksheets(i).Visible = True Then
Visible = Visible + 1
End If
Next
If Target.Address = "$A$1" And Visible 1 Then
If Target.Value = 2 Then ActiveSheet.Visible = False
End If
End Sub
"Mike H" wrote:
Hi,
Working backwards the will make any visible sheet hidden if a 2 is put in A1
of that sheet. Back to my original question. How is the 1 put in A1 to make
it visible again?
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
For i = 1 To Worksheets.Count
If Worksheets(i).Visible = True Then
Visible = Visible + 1
End If
Next
If Target.Address = "$A$1" And Visible 1 Then
If ThisWorkbook.Sheets.Count 1 Then
If Target.Value = 2 Then ActiveSheet.Visible = False
End If
End If
End Sub
Mike
" wrote:
Dear Mike,
Yup!! A mistake there!! should have been Hide. Sorry!!
|