+ Reply to Thread
Results 1 to 3 of 3

Lock cells within a row based on cell value

  1. #1
    Forum Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Lock cells within a row based on cell value

    I want to run a macro that will protect all the cells of a range within a row based on the value of two cells within that same row.

    This only needs to run once so a worksheet change is not necessary but it needs to be a small code instead of a conditional format because it needs to run after another macro runs. If i make it conditional, it will prevent my code from running.

    I need to watch C1 and H1 to determine if R1:AI1 need to be locked or not.

    If C1 = "Apple" then R1:AI1 = locked
    OR
    If H1 = "Pear" then R1:AI1 = locked

    This has to be done on multiple rows (137 to be exact). Is there any way to do this using VBA?
    Last edited by PY_; 11-14-2010 at 01:06 AM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: Lock cells within a row based on cell value

    Hi PY,

    You might try:
    Please Login or Register  to view this content.
    The Locked property doesn't take effect until you protect the worksheet, of course.

  3. #3
    Forum Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Re: Lock cells within a row based on cell value

    That woks perfectly. Thanks so much Paul!

+ Reply to 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