Consulting

Results 1 to 4 of 4

Thread: Solved: VBA write to a protected cell and I have the password

  1. #1

    Red face Solved: VBA write to a protected cell and I have the password

    I want a checkbox click() sub to write a value to a cell. I got this part down pat an works just fine. But I want to write protect the sheet so the user doesn't fat-finger something and break the formula's that I so-carefully put together.

    So, naturally I protected the sheet with a specific password. But now my checkbox click() events are locked out. Can I "enter" the password for my VBA commands somehow to allow them to work as normal?

    I realize that a determined individual could snarf out the password and still be malicious. That's not what I'm trying to prevent. It's the user who accidentally overwrites a formula or some other value.

    I want the checkboxes to control everything!!

    Thanks,
    Jeff

  2. #2
    Try this

    [vba]ActiveWorkbook.Sheets("Sheet1").Unprotect "password"
    Range("A1") = "hehehe"
    ActiveWorkbook.Sheets("Sheet1").Protect "password"
    [/vba]
    Jimmy
    -------------------------------------------------
    The more details you give, the easier it is to understand your question. Don't save the effort, tell us twice rather than not at all. The amount of info you give strongly influences the quality of answer, and also how fast you get it.

  3. #3
    That was it! Thanks for the quick and simple code to use!

  4. #4
    Alternatively you could look at this thread http://vbaexpress.com/forum/showthread.php?t=15826
    2+2=9 ... (My Arithmetic Is Mental)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •