During net search, have found a code to hide/unhide rows with zero values. The code is made for a command button. can this be made a simple macro ie without using command button?

Also when run this hides all rows ?

Private Sub CommandButton1_Click() Static flag As Boolean If flag Then For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1 If Cells(i, 3) = 0 Or Cells(i, 4) = 0 Or Cells(i, 5) = 0 Then Cells(i, 1).EntireRow.Hidden = True End If Next Else ActiveSheet.Rows.Hidden = False End If flag = Not flag End Sub


Can someone please modify the same?