+ Reply to Thread
Results 1 to 15 of 15

How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

  1. #1
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    Hi!

    I have a few Worksheets, each one has their own functions, some have multiple Modules and buttons, etc... but the entire Workbook and all sheets must be locked or "Protected"... if so, some functions don't work.

    So is there a VBA code I can add to the Workbook, to temporarily unlock/unprotect everything for a Module or button to do it's job, then put it back in protection mode again?

    Thanks!

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    if you add the following to the ThisWorkbook module your code will be able to do almost anything without issue
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    It works... there is only one function that doesn't while under protection. And that's a ComboBox. As long as the "Cell Link" is locked. It can't work. So, anything to get around this? Perhaps assign a Macro to the ComboBox??? I dunno?

    Thanks!

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    don't lock the linked cell. :-)

  5. #5
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    Right. But is there any other option besides that?

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    don't link it. use code to populate the cell in the change event of the combobox (or the assigned macro if it's a Forms control)

  7. #7
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    btw there is no need to pm me to tell me you've posted-I get notified by email

  8. #8
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    Okay that sounds good, only if I knew how to do that. Keep in mind though, there are other VB code and worksheets that are feeding off of the information that cell link provides. Thoughts?

  9. #9
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    Also of note, the "Input Range" remains locked, and the comboBox still works. However, only the "Cell link" is the issue when locked.

  10. #10
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    the input range isn't being changed so that's not an issue. is there a reason you can't unlock the linked cell?

  11. #11
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    Quote Originally Posted by JosephP View Post
    the input range isn't being changed so that's not an issue. is there a reason you can't unlock the linked cell?
    The main reason why cells are locked is because users who are not so computer savvy may inadvertently delete cells that they shouldn't, thus compromising the programming. So all cells are locked, except the ones for data entry.

    The user uses the "ComboBox" to make a selection and thus "changes" his choice based on the input range. And his choice generates a different result in the "Cell Link."

  12. #12
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    Quote Originally Posted by nenadmail View Post
    So all cells are locked, except the ones for data entry.
    but the linked cell is for data entry. if they delete the contents then selecting an item from the combobox will reinstate the value.

  13. #13
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    That's true. Besides, I guess I'm asking for something that can't be done.
    Thanks for your help! Everything else works great!

  14. #14
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    oh it can be done-I just don't see the need. ;-)

  15. #15
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: How to globally get Macros to work around "Protected" /Locked Worksheets and Workbooks

    That's true. Besides, I guess I'm asking for something that can't be done.
    Thanks for your help! Everything else works great!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1