Problem with protecting sheet

paul_bam

New Member
Joined
Aug 10, 2007
Messages
23
Hello everyone,

I have a problem with protecting a sheet. Here is the problem: The sheet is password protected, then the VBA script unprotects the sheet, then the VBA script runs and finally re-password protects the sheet (nothing wrong with that). However, I require that the user of the sheet can use an auto filter that I set up on column A. The problem that I have is that when the VBA script has finished it passwords protects the sheet but it has not allowed the use of Auto Filter, even though I checked this box originally.

Any help would be very much appreciated.

Thanks in advance

Paul

Here is the code that I am using at present.

Code:
ActiveWorkbook.Sheets("Induction Log").Activate
    Application.ScreenUpdating = False
    Sheets("Induction Log").Unprotect Password:="*******"
    Range("A1").Select
    Do
    If IsEmpty(ActiveCell) = False Then
        ActiveCell.Offset(1, 0).Select
    End If
    Loop Until IsEmpty(ActiveCell) = True
    ActiveCell.Value = txtName.Value
    ActiveCell.Offset(0, 1).Value = DateValue(txtDate.Text)
    ActiveCell.Offset(0, 2) = txtPayroll.Value
    ActiveCell.Offset(0, 3) = txtBuddy.Value
    Application.ScreenUpdating = True
    Sheets("Induction Log").Protect Password:="*******"
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Include the AllowFiltering argument:

ActiveSheet.Protect Password:="*******", AllowFiltering:=True

Hello,

Thanks for the amended code. I now the functionality I require.

Thanks for your help it is very much appreciated.

Paul
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,436
Members
449,083
Latest member
Ava19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top