+ Reply to Thread
Results 1 to 3 of 3

Excel 2007 : Translate worksheet dropdown list actions to VBA for a userform

  1. #1
    Registered User
    Join Date
    12-24-2010
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    89

    Translate worksheet dropdown list actions to VBA for a userform

    Morning

    On the attached sheet, the idea is to select a state from the first dropdown list. then the second dropdown list is populated with the cities of the state selected. The third dropdown list is populated with the airports associated with the city selected.

    Works fine.

    Instead of the dropdown lists being on a worksheet, I would like to have a userform with comboboxes for the State, City, and Airport. Then on the worksheet D11:D13 would be filled with the selections from the userform.

    The problem is that I have no idea as to how to code in VBA the actions of the worksheet dropdown lists.

    Data validation for the dropdown lists:

    The state: = a range named States
    The city: =INDIRECT(B3)
    The airport: = INDEX(Sheet1!$P:$P,MATCH(Sheet1!$C$3&"|"&Sheet1!$D$5,Sheet1!$N:$N,0),1):INDEX(Sheet1!$P:$P,MATCH(Sheet1!$C$3&"|"&Sheet1!$D$5,Sheet1!$N:$N,0)+COUNTIF(Sheet1!$N:$N,Sheet1!$C$3&"|"&Sheet1!$D$5)-1,1)

    I would appreciate any help with the coding.

    George
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    12-24-2010
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    89

    Re: Translate worksheet dropdown list actions to VBA for a userform

    The attached has some of the kinks kinda worked out.

    Still need a bit of help on the VBA syntax for INDEX MATCH

    I need to convert:

    Please Login or Register  to view this content.
    to VBA.

    I tried this:

    Please Login or Register  to view this content.
    but am getting compile error Sub or Function not defined.

    Been struggling with this since 6am. I have no idea of what I am doing. HELP!

    George
    Attached Files Attached Files

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Translate worksheet dropdown list actions to VBA for a userform

    Not sure if this what you mean.

    I've tidied up the code, but you can't use worksheet functions like that

    In future post links to all forums with cross posts!!!
    Attached Files Attached Files
    Last edited by royUK; 04-22-2012 at 01:48 PM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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