+ Reply to Thread
Results 1 to 4 of 4

Lock Cell based on another cell's value!

  1. #1
    Registered User
    Join Date
    01-07-2013
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    2

    Lock Cell based on another cell's value!

    Hi,

    I'm fairly new to Excel and this forum in particular. I am working on trying to restrict a users ability to input a number in a cell if the value of a different cell is above a certain amount.

    For example, if the value in cell "A1" is > $150K, then the user should not be able to input a value in cell "B1".

    I have looked around different postings, and am unable to find what I need. I am a beginner at VBA, so have difficulty with tweaking code written to solve other problems. I don't understand when to use "SelectChange", "Change", or "Worksheet", etc.

    Thank you in advance for your help.

    Regards,
    Michael

  2. #2
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    Re: Lock Cell based on another cell's value!

    Hello Michael
    Welcome to the forum.
    Something like this should give you the idea.
    The code is in the Selection_Change event of the Sheet that is changing i.e. Sheet1 in this case.
    This event generates an in-built variable called Target which is the address of the cell being changed/clicked.
    This can be trapped/tested with code.

    Please Login or Register  to view this content.
    barry
    If this was helpful then please click the small star icon at the bottom left of my post. A little appreciation goes a long way.

  3. #3
    Registered User
    Join Date
    01-07-2013
    Location
    NY
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Lock Cell based on another cell's value!

    Thank you very much Barry,

    I ended up using a "Data Validation" which was sufficient for our needs this time around, but your response did the trick that I had been searching for all afternoon.

  4. #4
    Valued Forum Contributor
    Join Date
    06-19-2010
    Location
    Holywell, N Wales, UK
    MS-Off Ver
    Excel 2013
    Posts
    470

    Re: Lock Cell based on another cell's value!

    Many thanks and glad you are sorted.
    Would you please mark this thread as SOLVED

+ 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