+ Reply to Thread
Results 1 to 5 of 5

VBA - Turn sheet lock on/off

  1. #1
    Registered User
    Join Date
    05-10-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    15

    VBA - Turn sheet lock on/off

    In my workbook I've got a sheet which only shows information from 1 other sheet. I don't want the user to open an edit this sheet without a password.
    Is it possible to write som VBA code which turns this lock off, get the data and then put the lock on again in my macro?

    Because if i lock the sheet know or hide it, my macro does not work since it can't get the information.

    Does any of your got a smart suggestion on how to fix this little problem?


    Thanks in advance.

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: VBA - Turn sheet lock on/off

    Hi

    Try this:

    Book1.xlsm
    Click *, if my suggestion helps you. Have a good day!!

  3. #3
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: VBA - Turn sheet lock on/off

    hi,
    you can try this...
    Please Login or Register  to view this content.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  4. #4
    Registered User
    Join Date
    05-10-2012
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: VBA - Turn sheet lock on/off

    Quote Originally Posted by john55 View Post
    hi,
    you can try this...
    Please Login or Register  to view this content.
    Hey John. The above code locks every sheet when i start my workbook from what I understand of the code?

  5. #5
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,028

    Re: VBA - Turn sheet lock on/off

    hi,
    yes it locks all sheets but yr code works.
    or you can add to every piece of code
    Please Login or Register  to view this content.
    or the solution provided by jraj
    Please Login or Register  to view this content.

+ 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