• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Help to Hide rows on password protected worksheet

ebank23

New Member
Below is the code I'm using to hide rows on my protected worksheet. What I want is all cells in colmn "A" that has "1" will be hidden. This is what I have but it takes forever. Thanks in advance for ANY help.

Code:
Private Sub CommandButton1_Click()
ActiveSheet.Unprotect Password:="password"
For a = 2 To 5000
If Worksheets("CLIENT SCHEDULE").Cells(a, 1).Value = "1" Then
    Worksheets("CLIENT SCHEDULE").Rows(a).Hidden = True

End If
   
Next
ActiveSheet.Protect Password:="password"
End Sub
Private Sub CommandButton2_Click()
For a = 2 To 5000
If Worksheets("CLIENT SCHEDULE").Cells(a, 1).Value = "1" Then
    Worksheets("CLIENT SCHEDULE").Rows(a).Hidden = False

End If
   
Next

End Sub
 
Last edited by a moderator:
As per forum rules, you forgot the code tags via the Insert icon !​
For your need, the obvious and fast way is an Excel basics like for example a filter just needing a single codeline …​
 
Back
Top