+ Reply to Thread
Results 1 to 4 of 4

Lock certain cells only if condition exists in another cell

  1. #1
    Registered User
    Join Date
    12-15-2013
    Location
    Cumming,GA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Question Lock certain cells only if condition exists in another cell

    I need to know how to write a macro or function for the following problem in Excel 2010. In Columns A & B, Rows 1 thru 19, there are entries and/or formulas. Row 20 is a sum of of rows 1 thru 19.

    Is it possible through a function or macro to protect or lock columns A & B and rows 1 thru 19, if the total in row 20 is above 149.? The previous data in Rows 1 thru 19 would remain and not change or be replaced with other data.

    If this is possible, how would I write the command for this. Thank you.

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Lock certain cells only if condition exists in another cell

    this simple macro copied into your sheet (not in a module) should do it:

    Please Login or Register  to view this content.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    12-15-2013
    Location
    Cumming,GA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Lock certain cells only if condition exists in another cell

    Thank you for your macro command to solve the problem. You state "this simple macro copied into your sheet (not in a module) should do it:". I don't understand the difference in copying the macro into a sheet rather than a module. Can you tell me how to do this? Thank you.

  4. #4
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Lock certain cells only if condition exists in another cell

    When you're in VBA editor, you doubleclick on your sheet name then you copy the lines of code in the white page at the right.
    This is a special macro called " event procedure" because it is trigger by a specific action done on this sheet only. In this case, any change in the sheet will trigger the macro which looks at specific cells values and do actions.
    Hope this help. If not, i can attach a file for you to test.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 10-03-2013, 03:30 PM
  2. [SOLVED] check if number in once cell exists in a range of cells and if yes, format another cell
    By beaujolais44 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-16-2013, 07:23 AM
  3. Lock Cell based on Condition and Repeat till Last Row
    By georgeanaprop in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-21-2010, 07:23 AM
  4. Lock Cell/s if condition satisfied.
    By cminoza in forum Excel General
    Replies: 1
    Last Post: 10-07-2009, 09:21 AM
  5. Lock cells from user data entry based on certain condition
    By sa02000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-18-2009, 02:49 AM

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