Forum Discussion
INeedHelpSoon
Jul 26, 2022Copper Contributor
Protect WorkSheet but change cell values via VB without password dialogue
I have a worksheet with macro control. Other than control, the whole sheet is "locked" and password protected. When clicking on the control, I want to change some values in the worksheet (via VB code) w/o the "supply password" dialogue box coming up - yet I don't want to put a line of code in the VB that "supplies" the password as that would make it to easy for users to view.
How can this be accomplished?
- JKPieterseSilver ContributorYou can't have VBA code unprotect a sheet without the PW dialog and at the same time without including the password. But you can protect the VBA project so others cannot see the password. Would that help?
- INeedHelpSoonCopper Contributor
Yes that would help... suggestion?
- JKPieterseSilver Contributor
INeedHelpSoon Sure, something like:
Sub ChangeSomething() ActiveSheet.Unprotect "PasswordGoesHere" Range("C3").Value = "Entry Into cell C3" ActiveSheet.Protect "PasswordGoesHere" End Sub