+ Reply to Thread
Results 1 to 13 of 13

Populating dropbox depending on the value of another dropbox

  1. #1
    Registered User
    Join Date
    10-28-2012
    Location
    brussels
    MS-Off Ver
    Excel 2007
    Posts
    39

    Populating dropbox depending on the value of another dropbox

    Hi,

    I have a code to populate 2 dropboxes. The first one contains surnames, the second forenames.

    The surnames are filled like this :
    Please Login or Register  to view this content.
    The forenames like this :
    Please Login or Register  to view this content.
    Surnames has a standard value, before clicking, "Achternaam", forenames has a standard value "Voornaam".
    Now, what I would like to add to my codes is when you select one of the surnames, you only get corresponding forenames. And vica versa. So when Kind1AN has a value of "Achternaam" or "" (it might be you delete the value to restart and the default is gone too) and you select a forename in Kind1VN, Kind1AN is not populated with all the surnames in column H, but only with those who have a corresponding forename available in column I. Same thing when you first choose a surname, the list with forenames is filled with only those who correspond with that surname.


    Thanks in advance

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

    Re: Populating dropbox depending on the value of another dropbox

    Please post example file with all necessary data to provide answer.
    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.

  3. #3
    Registered User
    Join Date
    10-28-2012
    Location
    brussels
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Populating dropbox depending on the value of another dropbox

    The file as requested
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-28-2012
    Location
    brussels
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Populating dropbox depending on the value of another dropbox

    Bump for a solution

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

    Re: Populating dropbox depending on the value of another dropbox

    Got it working for surnames. Not sure yet how to combine it with vice versa code for forenames.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    10-28-2012
    Location
    brussels
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Populating dropbox depending on the value of another dropbox

    damn this is nice ; thanks a lot bakerman2 !

    Don't worry about the other option, it's not that important it was something to have if it was an easy fix

  7. #7
    Registered User
    Join Date
    10-28-2012
    Location
    brussels
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Populating dropbox depending on the value of another dropbox

    Do you have any idea why I'm having this problem :

    I copied your code to the real workbook. Everything else stayed the same, just the userform code was replaced. But now, when I click my button I get an error message : runtime error "9" subscript out of range. And when I click debug it goes to my module and highlights the ingave.show line ...

  8. #8
    Registered User
    Join Date
    10-28-2012
    Location
    brussels
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Populating dropbox depending on the value of another dropbox

    got it figured out had to change "Blad1" to my sheet name thanks again, solved now ^^

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

    Re: Populating dropbox depending on the value of another dropbox

    You're welcome and thanks for adding rep points.

  10. #10
    Registered User
    Join Date
    10-28-2012
    Location
    brussels
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Populating dropbox depending on the value of another dropbox

    Strange extra problem

    I copied the code to my real form. As in the file posted here, the surnames start at H15 and the forenames as I15. Yet, when I open macro and click the dropbox, I get the values in column G ...

    untitled1.JPG
    untitled2.JPG
    untitled3.JPG
    untitled4.JPG
    Last edited by megabolic; 02-01-2017 at 03:16 AM.

  11. #11
    Registered User
    Join Date
    10-28-2012
    Location
    brussels
    MS-Off Ver
    Excel 2007
    Posts
    39

    Re: Populating dropbox depending on the value of another dropbox

    OK, solved by changing all the 1's to 2's and the 2's to 3's. Dunno why, it's a type of code i can't understand but it works now ^^

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

    Re: Populating dropbox depending on the value of another dropbox

    Try this way.

    Please Login or Register  to view this content.

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

    Re: Populating dropbox depending on the value of another dropbox

    In your example file you had only 2 adjacent columns. In your real file you also use columnG so using currentregion includes that column in the array a.

+ 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. Addin in dropbox
    By robato in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-28-2016, 10:11 AM
  2. Dropbox inquiry
    By Trexx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2016, 06:39 AM
  3. VBA Dropbox links
    By PetiteMorte in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-27-2015, 10:00 AM
  4. need to add another value in the dropbox
    By rolosa in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-30-2014, 12:09 PM
  5. need to add another value in the dropbox
    By rolosa in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-30-2014, 10:49 AM
  6. Excel VBA Code to upload a file to Dropbox using the Dropbox API
    By gb# in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-02-2014, 03:41 PM
  7. DropBox Calulation
    By brandnicks in forum Excel General
    Replies: 2
    Last Post: 12-02-2011, 09:56 AM

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