+ Reply to Thread
Results 1 to 8 of 8

Disable cells in a row based on condition

  1. #1
    Registered User
    Join Date
    08-19-2010
    Location
    Kerala, India
    MS-Off Ver
    Excel 2003
    Posts
    41

    Unhappy Disable cells in a row based on condition

    Hello Everybody, This is my first thread in excel, But I have visited this site many times before and got many help from you guys.So this the first chance to thank you all GUYS.THANK YOU SOOOO MUCH

    I am having a serious problem now, I wanted help in disabling a few cells in a single row based on the value of a pirticular cell value at the begning. For Eg: if A1 is a drop down with values YES and NO If i select Yes Nothing should happen,but if i select NO the next few cells like B1,C1,D1 etc should be disabled and it should go down to like approx A50.

  2. #2
    Forum Contributor
    Join Date
    05-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    315

    Re: Disable cells in a row based on condition

    The following code will protect range B1:D10 if the value in cell A1 is No. Otherwise the range will be unprotected. Copy the code into the Worksheet_Change event of the sheet you want to protect (you'll need to change the sheet name Sheet1 to whatever your sheet is called and change the password from 123 to whatever password you want to use).

    Dion


    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-19-2010
    Location
    Kerala, India
    MS-Off Ver
    Excel 2003
    Posts
    41

    Re: Disable cells in a row based on condition

    Thanks for help me out.But a few changes what I wanted is when I select NO in A1, i want the cells B1,D1, C1 till F1 to be disabled only and then If i select A2 as NO I want the cells B2,D2,C2 till F2 be disabled, and if i select A3 as YES i should be able to enter information on to B3,C3,D3 till F3,+ one more situation if i go back to A1 or any cell in column A to Yes i should be able to enter information on the corresponding row.I hope this explains the situation a little more in detail

  4. #4
    Forum Contributor
    Join Date
    05-09-2009
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    315

    Re: Disable cells in a row based on condition

    Oh I see. Try this then:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    12-22-2015
    Location
    San Antonio, Texas
    MS-Off Ver
    2016
    Posts
    116

    Re: Disable cells in a row based on condition

    Mojo249,
    I tried to use your code as the skeleton for my workbook, paying attention to try to change the code to fit my workbook, to no such luck. Could you please help me? I want to learn and I’m willing to do all the work!

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Disable cells in a row based on condition

    Select B1:C1
    Invoke DataValidation and use the formula =($A1<>"YES")

    Copy the validation to the other rows.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  7. #7
    Forum Contributor
    Join Date
    12-22-2015
    Location
    San Antonio, Texas
    MS-Off Ver
    2016
    Posts
    116

    Re: Disable cells in a row based on condition

    mikerickson, that isn't what I need.

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: Disable cells in a row based on condition

    You can start by telling us what doesn't work and what changes you've made to the code. Also explaining what you're trying to achieve might help.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

+ 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