tuccokeith
Technical User
Hello,
The code below uses a commandbutton to open a protected worksheet, unprotect it, and then uses the autofilter to remove blank lines.
How can I adjust this code so that the protection can be automatically turned back on after the autofilter is invoked?
Private Sub CommandButton2_Click()
Const PW = "hipaa"
If CommandButton2.Caption = "Alt Address 1" Then
Workbooks("IndividualRightsDatabase.xls"
.Worksheets("Alt_Address1"
.Activate
Me.Unprotect PW
Selection.AutoFilter Field:=2, Criteria1:="<>"
End If
End Sub
The code below uses a commandbutton to open a protected worksheet, unprotect it, and then uses the autofilter to remove blank lines.
How can I adjust this code so that the protection can be automatically turned back on after the autofilter is invoked?
Private Sub CommandButton2_Click()
Const PW = "hipaa"
If CommandButton2.Caption = "Alt Address 1" Then
Workbooks("IndividualRightsDatabase.xls"
Me.Unprotect PW
Selection.AutoFilter Field:=2, Criteria1:="<>"
End If
End Sub