Closed Thread
Results 1 to 7 of 7

How do I lock cells when it has value using macro?

  1. #1
    Registered User
    Join Date
    02-26-2004
    Location
    philippines
    Posts
    73

    How do I lock cells when it has value using macro?

    Guys,

    Can someone help me with protect macro, I've never use this before.

    I just need to lock cells once it has a value. This needs to make the data accurate. It can only be unlock using a password.

    Anyone?

  2. #2
    Registered User
    Join Date
    01-29-2007
    Posts
    92
    Here's my best shot at this

    Open VBA. Editor
    doubble click sheet1.
    Copy and Paste code below into sheet1.

    The below code must be located in sheet1 or you will have to change the sheet index value to match your sheet.

    Please Login or Register  to view this content.
    How it works.
    1. Only blank cells can be changed
    2. Once a blank cell has data entered, it cannot be changed again (only one chance to enter data )
    3. Sheet can only be unlocked with a password.

    Note that the password in my code is "Secret", you can change this to anything you wish but the password will be visible to anyone who knows how to use VBA. I'm not if and how that can be hidden.

    Cheers
    Schwizer

  3. #3
    Registered User
    Join Date
    02-26-2004
    Location
    philippines
    Posts
    73
    It's not working...

    Quote Originally Posted by Schwizer
    Here's my best shot at this

    Open VBA. Editor
    doubble click sheet1.
    Copy and Paste code below into sheet1.

    The below code must be located in sheet1 or you will have to change the sheet index value to match your sheet.

    Please Login or Register  to view this content.
    How it works.
    1. Only blank cells can be changed
    2. Once a blank cell has data entered, it cannot be changed again (only one chance to enter data )
    3. Sheet can only be unlocked with a password.

    Note that the password in my code is "Secret", you can change this to anything you wish but the password will be visible to anyone who knows how to use VBA. I'm not if and how that can be hidden.

    Cheers
    Schwizer

  4. #4
    Registered User
    Join Date
    01-29-2007
    Posts
    92
    Sry to leave u hanging there,

    Try this attached worksheet if you're still having issues. (use sheet1)

    Cheers
    Schwizer
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-04-2009
    Location
    india
    MS-Off Ver
    Excel 2003;2007
    Posts
    1

    Thumbs up Re: How do I lock cells when it has value using macro?

    The code presented on the posts has a few lines missing.Other than that i works like a charm.Thank you.

  6. #6
    Registered User
    Join Date
    11-04-2009
    Location
    asdfds
    MS-Off Ver
    sdafsd
    Posts
    1

    Re: How do I lock cells when it has value using macro?

    you can change this to anything you wish but the password will be visible to anyone who knows how to use VBA. I'm not if and how that can be hidden.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How do I lock cells when it has value using macro?

    Folks, this is a 2-year old thread. Please start a new one if you'd like to continue.
    Entia non sunt multiplicanda sine necessitate

Closed 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