Hello,
I found some excellent code to add and delete table rows in protected sheets here: Insert & Delete Table Rows With Worksheet Protection — The Spreadsheet Guru
I'm trying to modify it to add enable filtering and sorting but confused about the syntax and what I've tried is working so far
The author's code seems to set a variable for the password
which is then used like this:
So I thought I could get it allow filtering by doing this:
But that doesn't compile, so based on this: Excel VBA protect worksheet with password, I tried this:
But that doesn't work either.
What is the correct syntax?
I found some excellent code to add and delete table rows in protected sheets here: Insert & Delete Table Rows With Worksheet Protection — The Spreadsheet Guru
I'm trying to modify it to add enable filtering and sorting but confused about the syntax and what I've tried is working so far
The author's code seems to set a variable for the password
VBA Code:
Dim Password As String
Password = ""
which is then used like this:
VBA Code:
ActiveSheet.Protect Password
So I thought I could get it allow filtering by doing this:
VBA Code:
ActiveSheet.Protect Password, AllowFiltering:=True
VBA Code:
ActiveSheet.Protect (Password=Password, AllowFiltering)
But that doesn't work either.
What is the correct syntax?