Autofill from dropdown

Last Edited By Krjb Donovan
Last Updated: Mar 05, 2014 09:16 PM GMT

QuestionEdit

I have an2007 Worksheet in which I have 2 columns: Banks and Countries. One Country can have from 1 up to 6 or 10 banks. What I want to do is to allow the users to select the country and based upon that selection, I wantto provide automatically a list with the related banks, but only the related banks to that country. For example, if I select "United States" I want the Banks list to show: Wells Fargo, Bank of Iowa, Chase Bank, Bank of America. But I don't want the user to select another bank from another country, for example, HSBC Mexico. I don't know so much the Combo box command but I haven't been able to "print" the selected item on the worksheet so far. I want both values selected (Country and Bank) to be printed or "written" on the worksheet so that if I want to send that data to other user as a report, he can see what's written on each cell.

Could you help me?

AnswerEdit

One good use of Data Validation comes when there's a need to "link" two or more comboboxes, making them, dependant.

For example,

"I have a list of countries (USA, Australia, England), and a list of cities. How can I make than when the user selects USA in one cell, in the other one appear only cities from USA (New York, Los Angeles), and also for Australia (Camberra, Perth), etc. ?"

The first thing that needs to be done is name the lists. Select the countries, without the title, and name it COUNTRIES. Next, select all cities (Again without titles) from USA and name it USA. Continue this process for every country.

Now, let's assume that the first list appears in A1. Go to Data, Validation, Select List, and in "Source" put

=COUNTRIES.

Make sure that "In-cell dropdown" is checked. Now, if the second list appears in B1, go to Data, Validation, again Select List, and in "Source" put

=INDIRECT(A1)

Ifreturns an error, don't worry, you don't have anything selected in A1. To test it, select a country in A1, and now, when you click in B1 you should see only the cities from that country.

Remember that Defined Names can't include spaces, so, to enter, Great Britain, you would have to put it like "Great_Britain" or "GreatBritain".

Have a look in the below link for more details:-

http://contextures.com/xlDataVal02.html

Advertisement

©2024 eLuminary LLC. All rights reserved.