I need help in creating a VBA code to automatically enable AutoFilter from B7:N7 when sheet 2 is selected. Sheet 2 is protected with a password and cell B7:N7 is locked.
Hope anyone can help me. Thanks.
I need help in creating a VBA code to automatically enable AutoFilter from B7:N7 when sheet 2 is selected. Sheet 2 is protected with a password and cell B7:N7 is locked.
Hope anyone can help me. Thanks.
I've never used a worksheet open event before, but I found this code on another website and think it may work. Enter your password for the locked cells in the quotations below that say "enterpasswordhere".
Also, I wasn't sure how to make this macro apply to only Sheet2, so I added an IF statement to always check to see if the active sheet is Sheet2 when you open any worksheet.
Private Sub Worksheet_Activate()
If ActiveSheet.Name = "Sheet2" Then
ActiveSheet.Unprotect "enterpasswordhere"
Range("B7:N7").Select
Selection.AutoFilter
End If
End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks