madchemist
Board Regular
- Joined
- Jul 10, 2006
- Messages
- 198
I have a userform that translates information into a row. I want to protect certain columns in the row to prevent users from accidentally changing data.
I know I need to place an .Unprotect and .Protect command in my macro to be able to let the macro enter information, but keep getting errors when I try and put a password in the code.
This is the macro I recorded:
In the past, I have always just used the following to lock:
How do I append a password to the protect command with the criteria after it? Because if I do either of the following I get errors.....
Am I missing a comma or something? Thanks!
I know I need to place an .Unprotect and .Protect command in my macro to be able to let the macro enter information, but keep getting errors when I try and put a password in the code.
This is the macro I recorded:
Code:
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:=True, AllowSorting:=True, AllowFiltering:=True
In the past, I have always just used the following to lock:
Code:
ActiveSheet.Protect Password = "password"
How do I append a password to the protect command with the criteria after it? Because if I do either of the following I get errors.....
Code:
ActiveSheet.Protect Password = "password" DrawingObjects:=False, Contents:=True, Scenarios:=True, AllowSorting:=True, AllowFiltering:=True
Code:
ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:=True, AllowSorting:=True, AllowFiltering:=True Password = "password"
Am I missing a comma or something? Thanks!