F
Faisal...
I am sorry for the confusion caused in my last two posts. Adding to
JP's comment, try this:
Private Sub CommandButton5_Click()
Application.ScreenUpdating = False
Activesheet.Unprotect(PASSWORD)
Dim cell As Range, rng As Range
Cells.Rows.Hidden = False
On Error Resume Next
Set rng = Columns(2).SpecialCells(xlConstants, xlNumbers)
On Error GoTo 0
For Each cell In rng
If cell.Value = 0 Then
cell.EntireRow.Hidden = True
End If
Next
Activesheet.Protect Password:="Secret", UserInterFaceOnly:=True
Application.ScreenUpdating = True
End Sub
JP's comment, try this:
Private Sub CommandButton5_Click()
Application.ScreenUpdating = False
Activesheet.Unprotect(PASSWORD)
Dim cell As Range, rng As Range
Cells.Rows.Hidden = False
On Error Resume Next
Set rng = Columns(2).SpecialCells(xlConstants, xlNumbers)
On Error GoTo 0
For Each cell In rng
If cell.Value = 0 Then
cell.EntireRow.Hidden = True
End If
Next
Activesheet.Protect Password:="Secret", UserInterFaceOnly:=True
Application.ScreenUpdating = True
End Sub