Protected sheet with auto filter problem

Corleone

Well-known Member
Joined
Feb 2, 2003
Messages
841
Office Version
  1. 365
I have the following code in the spreadsheet which creates a copy of the "signalling" worksheet and protects it, mainly so that the recipient cannot delete/insert open hidden columns etc,

However whilst the newly generated file is protected and the sort function is still working ,the auto filter is not.

Can anyone advise as to how i modify the code below in order to do make the auto filter available whlst still keeping the sheet protected?

Thanks


Sub CREATE_SIGNALLING_FILE()
'
' Macro1 Macro
' Macro recorded 15/07/2010 by shegarty
'

'

Sheets("SIGNALLING").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowSorting:=True, AllowFiltering:=True

Sheets(Array("COVER Sheet", "SIGNALLING", "CATEGORIES")).Select
Sheets("SIGNALLING").Activate

Sheets(Array("COVER Sheet", "SIGNALLING", "CATEGORIES")).Copy
Windows("Commissioning_Tool.xls").Activate
Sheets("PROCESS").Select
Range("B9").Select


Sheets("SIGNALLING").Select
ActiveSheet.Unprotect
Range("A1").Select
End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
If AllowFiltering is True the user can click the dropdown arrows and filter the data. But the filter must be in place before the worksheet is protected. It's not possible to create one afterwards.
 
Upvote 0
Hello - thanks for the reply

just tried it again will the auto filter drop downs on before running the macro

however in the copied file that it generates, the drop down filters are there in the protected file, but when i click on them - nothing happens
 
Upvote 0
This worked for me:

Code:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 17/07/2010 by Andrew
'
'
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
        , AllowFiltering:=True
    ActiveSheet.Copy
End Sub

I don't know why it's not working for you.
 
Upvote 0
This worked for me:

Code:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 17/07/2010 by Andrew
'
'
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
        , AllowFiltering:=True
    ActiveSheet.Copy
End Sub

I don't know why it's not working for you.

Thanks Andrew, I must have had an extra bit of code in my example at the top that it didnt like.

I started again using your example and it works fine now

many thanks
 
Upvote 0

Forum statistics

Threads
1,214,946
Messages
6,122,401
Members
449,081
Latest member
JAMES KECULAH

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