+ Reply to Thread
Results 1 to 19 of 19

How to protect worksheet containing macros - tried, but losing functionality

  1. #1
    Registered User
    Join Date
    01-30-2012
    Location
    cairns
    MS-Off Ver
    Excel 2003
    Posts
    29

    How to protect worksheet containing macros - tried, but losing functionality

    I'm trying to protect the attached worksheet, but regardless of what combination of 'locking' cells and/or protecting the worksheet it has problems where the code - particularly H14 and I14, a data validation conditional list - doesn't function properly....

    How can I protect the worksheet but still allow users to input data into row 14?

    PS: created on excel 2003
    Attached Files Attached Files

  2. #2
    Forum Contributor bonny24tycoon's Avatar
    Join Date
    04-02-2012
    Location
    Hell
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    405

    Re: How to protect worksheet containing macros - tried, but losing functionality

    Hi WillGe,

    Try this.. 2012 Dose Report (windows).xls


    I have protected the sheet with no password. So you unlock the sheet without a password.

    Let me know if this is what you needed.


    Thanks,

    Bonny Tycoon

    **If I was able to help please do not forget to click the small star icon at the bottom left of my post **

  3. #3
    Registered User
    Join Date
    01-30-2012
    Location
    cairns
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: How to protect worksheet containing macros - tried, but losing functionality

    Hi Bonny,

    For some reason protecting the worksheet knocks out the worksheet change code. This code applies to H14 & I14 - if you unprotect the sheet and click 'orthopaedics' in H14 then a list appears in I14, if you instead select 'Vascular' from H14 then a different list appears in I14. When the sheet is protected this function drops out and I have no idea why....

  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 protect worksheet containing macros - tried, but losing functionality

    your on error resume next is hiding the reason.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-30-2012
    Location
    cairns
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: How to protect worksheet containing macros - tried, but losing functionality

    Hi Joseph,

    I'm not an expert at code by any means, do you have any suggestions how to fix the problem? I'm not sure what you mean by the 'error resume hiding the reason' except I guess that that line of code is causing the issue (I got the code through other forum users, didn't write it myself). Any ideas?

  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 protect worksheet containing macros - tried, but losing functionality

    Quote Originally Posted by WillGe View Post
    do you have any suggestions how to fix the problem?
    use the code I just gave you ;-)

  7. #7
    Registered User
    Join Date
    01-30-2012
    Location
    cairns
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: How to protect worksheet containing macros - tried, but losing functionality

    Hi Joseph,

    Thanks for the code, only prob is I'm getting a runtime error when I use cells H14/I14, can you please have a go and see if you get the same error after protecting the worksheet. (I'm making sure the cells in row H are unlocked and then selecting protect worksheet under the Tools tab).

    Error is:
    Runtime error '1004':
    The password you supplied is not correct....

    The password is correct as I can unprotect the worksheet using it so why is it giving me this error?

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

    Re: How to protect worksheet containing macros - tried, but losing functionality

    did you change the password in the code I provided?
    Josie

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

  9. #9
    Registered User
    Join Date
    01-30-2012
    Location
    cairns
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: How to protect worksheet containing macros - tried, but losing functionality

    so 'password' is the password then? (Didn't know that could be set in code like that)

  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 protect worksheet containing macros - tried, but losing functionality

    yeah-change this to the actual password
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    01-30-2012
    Location
    cairns
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: How to protect worksheet containing macros - tried, but losing functionality

    Thanks I'll try that within a couple of days and let you know how I went !

  12. #12
    Registered User
    Join Date
    01-30-2012
    Location
    cairns
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: How to protect worksheet containing macros - tried, but losing functionality

    Thanks Joseph, works nicely.

    Can I ask another question of you? If I wanted to insert a calendar into the date cell B14 how can I do that? Preferably one that is not visible until selecting the cell or something, that you can then click on today's date (it will only ever be today's date anyway that people select).....

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

    Re: How to protect worksheet containing macros - tried, but losing functionality

    why use a calendar for one date? either let them use the keyboard shortcut or use say a right-/double-click to add the date.

  14. #14
    Registered User
    Join Date
    01-30-2012
    Location
    cairns
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: How to protect worksheet containing macros - tried, but losing functionality

    Using a click to add the date would be the best absolutely, how can I do that?

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

    Re: How to protect worksheet containing macros - tried, but losing functionality

    I'm just finishing a project so will post an example after that or in the morning. you want a worksheet_beforedoubleclick event.

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

    Re: How to protect worksheet containing macros - tried, but losing functionality

    ok this should do it
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    01-30-2012
    Location
    cairns
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: How to protect worksheet containing macros - tried, but losing functionality

    Hi Joseph, hoping you can get back to me with the click to add the date? Thanks!

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

    Re: How to protect worksheet containing macros - tried, but losing functionality

    see the post above yours. :-)

  19. #19
    Registered User
    Join Date
    01-30-2012
    Location
    cairns
    MS-Off Ver
    Excel 2003
    Posts
    29

    Re: How to protect worksheet containing macros - tried, but losing functionality

    Thanks Joseph!!!!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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