No that won't work, you need to have two separate macros for it. You would have to add something like this:
Option Explicit
Private Sub Worksheet_Activate()
Dim Ws As Worksheet
Dim RowCheck As Long
Set Ws = ActiveSheet
Application.ScreenUpdating = False
With Ws
For RowCheck = 1 To .Cells(.Rows.Count, 1).End(xlUp).Row
If .Cells(RowCheck, 1) = 0 Then
.Cells(RowCheck, 1).EntireRow.Hidden = True
Else
.Cells(RowCheck, 1).EntireRow.Hidden = False
End If
Next RowCheck
End With
Application.ScreenUpdating = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Ws As Worksheet
Dim RowCheck As Long
Set Ws = ActiveSheet
If Not Intersect(Target, Range("C3")) Is Nothing Then
Application.ScreenUpdating = False
With Ws
For RowCheck = 1 To .Cells(.Rows.Count, 1).End(xlUp).Row
If .Cells(RowCheck, 1) = 0 Then
.Cells(RowCheck, 1).EntireRow.Hidden = True
Else
.Cells(RowCheck, 1).EntireRow.Hidden = False
End If
Next RowCheck
End With
Application.ScreenUpdating = True
End If
End Sub
Since there are two different events involved, you need two separate macros for it. Each event macro works for only one event. (event is the action that triggers it "select the tab", in fact activate the sheet, or "change C3")
Bookmarks