passin through
New Member
- Joined
- Apr 25, 2015
- Messages
- 8
Is it possible to protect a sheet and/or workbook and assign a macro to a button which will Filter on and off the predetermined rows while the sheet is protected? When the sheet is unprotected, the macro runs exactly as desired.
On the Protect Sheet tab I have the SORT and AutoFilter boxes checked.
Currently using the following code:
ActiveSheet.Range("BCD_SORT_COLUMNS").AutoFilter Field:=2
When the routine is run, it halts and gives the following error message:
Run-time error ‘1004’:
You cannot use this command on a protected sheet. To use this command, you must first unprotect the sheet (Review tab, Changes group, Unprotect Sheet button). You may be prompted for a password.
The cells set up to use the FILTER are shown in the Advanced Filter dialog box as follows:
List range: $B$9:$C$301
Criteria range: $B$10:$FD$298
The cells named "BCD_SORT_COLUMNS" are $B$9:$C$301
On the Protect Sheet tab I have the SORT and AutoFilter boxes checked.
Currently using the following code:
ActiveSheet.Range("BCD_SORT_COLUMNS").AutoFilter Field:=2
When the routine is run, it halts and gives the following error message:
Run-time error ‘1004’:
You cannot use this command on a protected sheet. To use this command, you must first unprotect the sheet (Review tab, Changes group, Unprotect Sheet button). You may be prompted for a password.
The cells set up to use the FILTER are shown in the Advanced Filter dialog box as follows:
List range: $B$9:$C$301
Criteria range: $B$10:$FD$298
The cells named "BCD_SORT_COLUMNS" are $B$9:$C$301