+ Reply to Thread
Results 1 to 4 of 4

How to lock a cell based on a choice in a dropdown box?

  1. #1
    Registered User
    Join Date
    02-05-2019
    Location
    PH
    MS-Off Ver
    2016
    Posts
    44

    How to lock a cell based on a choice in a dropdown box?

    Hello, I need help Vba masters.

    This might need a vba, can anyone help me if this is possible?

    I need to lock all other cell based on the salary grade level. I managed to highlight it based on manually putting conditional formatting with a color red on each box.

    But is there anyway to have a vba code for this so instead of highlighting the cell it will be disabled or lock or uneditable instead?

    I just need the formula or how it is done and I can study and hopefully apply the rest.

    I'd really appreciate any help.

    Thanks.
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,698

    Re: How to lock a cell based on a choice in a dropdown box?

    I have analyzed your existing conditional formatting rules and cannot figure out the logic you want to apply. Also, you say "I need to lock all other cell" and "instead of highlighting the cell it will be disabled or lock or uneditable instead". What cells do you want to lock?

    I suspect this can be done with data validation rather than VBA but it is unclear what you need to do. Please explain how you are using the DIVISION1 sheet and what you are trying to do.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    02-05-2019
    Location
    PH
    MS-Off Ver
    2016
    Posts
    44

    Re: How to lock a cell based on a choice in a dropdown box?

    Hello,

    Let's say an employee chooses, Grade A on the Sheet1!D4 cell. Since Grade A is for Basic, all cells that is not applicable for him (Intermediate, advanced and superior) on his column in Division A and Division B will be locked or uneditable.

    Then another employee again will enter his name and choose a Salary Grade. If he selects intermediate then the advanced and superior is not applicable to him this applies to both column D in division 1 and Divsion 2.

    I tried using conditional formatting which instead of locking a cell, it will highlight red instead.

    But is there a way to make a cell not editable or disabled, locked etc based on the dropdown box? like a validation formula? Or does it need some vba?

    Thanks for the help.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,698

    Re: How to lock a cell based on a choice in a dropdown box?

    Your formatting works against you. I've done my best with your merged cells but merging cells is not recommended. People like to do it for presentation reasons but it makes data manipulation harder.

    This assumes that the order of the names in row 2 of DIVISION1 is the same as in column B of Sheet1.

    In DIVISION1!C5 use this as a Data Validation Custom rule:

    =OFFSET(Sheet1!$D$4,COLUMNS($C1:C1)-1,0)="GRADED"

    Repeat for the three BASIC ratings. Use GRADEC for INTERMEDIATE, and so on.

    Once you have set these in the first column you can copy and Paste Validation to the subsequent columns.

    I did C5 for you as an example.
    Attached Files Attached Files

+ 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. COUNTIF based on Data Validation dropdown choice
    By EPosejpal in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-13-2017, 03:44 PM
  2. Replies: 1
    Last Post: 10-26-2016, 08:54 PM
  3. [SOLVED] Calculating sums to a spesific cell depending on choice from dropdown.
    By Artsipappa in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-06-2015, 02:24 AM
  4. [SOLVED] Cell value dependant on dropdown list choice in another cell
    By Steveo251 in forum Excel General
    Replies: 5
    Last Post: 01-28-2013, 05:03 PM
  5. How to lock few cells based on a selection from dropdown
    By sashikanth2274 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-22-2010, 04:36 PM
  6. Autocomplete cell from choice on dropdown list
    By mc515 in forum Excel General
    Replies: 3
    Last Post: 10-23-2008, 10:05 AM
  7. populating a dropdown based on choice from a previous dropdown
    By Conor in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-09-2006, 03:20 PM

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