+ Reply to Thread
Results 1 to 4 of 4

Data Validation based on a condition drop-down menu VBA Code

  1. #1
    Forum Contributor
    Join Date
    09-01-2020
    Location
    bangladesh
    MS-Off Ver
    office 2007
    Posts
    167

    Data Validation based on a condition drop-down menu VBA Code

    When cell A2 is A, Cell E2 automatically becomes data validity, the content is 2, 3, 5, 8
    When cell A2 is S, Cell E2 automatically becomes data validity, the content is 1, 4, 6, 7, 9

    Can someone please help me ? It would be much appreciated
    Attached Files Attached Files
    Last edited by rayhen; 12-22-2022 at 03:17 AM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,319

    Re: Data Validation based on a condition drop-down menu VBA Code

    Create named ranges ListA and ListS

    For DV

    List

    =IF(D2="A",ListA,ListS)
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,612

    Re: Data Validation based on a condition drop-down menu VBA Code

    Worksheet event is used.
    code:
    Please Login or Register  to view this content.
    How to use workheet event the code
    Right click on Sheet tab --> view code
    Visual Basic (VB) window opens.
    Paste the code
    Close the VB window.
    Save the file as .xlsm
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 12-21-2022 at 11:03 AM.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Forum Contributor
    Join Date
    09-01-2020
    Location
    bangladesh
    MS-Off Ver
    office 2007
    Posts
    167

    Re: Data Validation based on a condition drop-down menu VBA Code

    Thanks to both of you, both methods can accomplish the task
    WOW kvsrinivasamurthy you are awesome thanks for your help problem solved

+ 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: 11
    Last Post: 10-25-2017, 05:00 PM
  2. Replies: 4
    Last Post: 10-28-2015, 12:59 PM
  3. How to run code automatically every time a drop-down validation menu changes
    By elgatnegre in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-19-2014, 04:45 PM
  4. Replies: 0
    Last Post: 10-14-2014, 08:39 AM
  5. Replies: 3
    Last Post: 08-23-2012, 12:43 PM
  6. Data Validation from drop down menu
    By ciapul12 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-01-2011, 04:18 PM
  7. Data Validation for Drop Down Menu?
    By typektunus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-25-2009, 04:42 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