+ Reply to Thread
Results 1 to 3 of 3

Macro: choosing a drop down list from another drop down list list!

  1. #1
    Registered User
    Join Date
    11-28-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    75

    Macro: choosing a drop down list from another drop down list list!

    Hello,

    I would like to choose a list based of the value selected in another list. For example:

    In A1 I have a drop down list that allows the user to choose between 1 or 2. If the user selects 1 then Cell A2 will have a certain drop down list, e.g.: A, B, C. If the user selects 2 then Cell A2 will have a different drop down list, e.g.: X, Y, Z.

    How do I do this with VBA?

    Thanks a lot in advance and I am looking forward to your replies

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Macro: choosing a drop down list from another drop down list list!

    123wc,

    Not sure why'd you need VBA. An IF() statement in the Data Validation Source will accomplish this, you would just need to set aside an area in the sheet to hold the lists.

    Attached is an example workbook based on the criteria provided. If A1 = G1 (1) then A2's list will be = G2:G4 (which is A, B, C). If A1 = H1 (2) then A2's list will be = H2:H4 (which ix X, Y, Z). Else, A2's list will be = I1 (which is a blank cell).

    Here's A2's Data Validation Source formula:
    =IF($A$1=$G$1,$G$2:$G$4,IF($A$1=$H$1,$H$2:$H$4,$I$1))
    Attached Files Attached Files
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    11-28-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2007
    Posts
    75

    Re: Macro: choosing a drop down list from another drop down list list!

    Thank you very much, your method works and it's easier

+ 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