If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Drop Down Box & Macro
Hello,
I want to create a macro so that when I select a country from a drop down box, then hidden data for the country appears. For example, I select Argentina from the box, then data will appear on the population, econmic info., etc. However, I can then choose Mexico from the box and the same data appears for Mexico. Thanks in advance. |
#2
|
|||
|
|||
Drop Down Box & Macro
You may not need a macro.
Say you have a table with all your info on it in sheet2--country name in column A. Then you could use a formula like: =if(a1="","",vlookup(a1,sheet2!a:e,2,false)) You may want to read Debra Dalgleish's notes: http://www.contextures.com/xlFunctions02.html A.S. wrote: Hello, I want to create a macro so that when I select a country from a drop down box, then hidden data for the country appears. For example, I select Argentina from the box, then data will appear on the population, econmic info., etc. However, I can then choose Mexico from the box and the same data appears for Mexico. Thanks in advance. -- Dave Peterson |
#3
|
|||
|
|||
Drop Down Box & Macro
Hi Dave,
I forgot to mention, that there is a catch. The reason I say I need a macro is that I want the data to be changeable & not from a list. Example: My Drop Down Box has countries from A-Z. The categories are population, and let's say internet penetration. Now, when I select Brazil, I input the population and internet penetration, after I do that, then I go back to the drop-down box and select China and input data for China. And I want to be able to do this for whichever country I choose. Any ideas? "Dave Peterson" wrote: You may not need a macro. Say you have a table with all your info on it in sheet2--country name in column A. Then you could use a formula like: =if(a1="","",vlookup(a1,sheet2!a:e,2,false)) You may want to read Debra Dalgleish's notes: http://www.contextures.com/xlFunctions02.html A.S. wrote: Hello, I want to create a macro so that when I select a country from a drop down box, then hidden data for the country appears. For example, I select Argentina from the box, then data will appear on the population, econmic info., etc. However, I can then choose Mexico from the box and the same data appears for Mexico. Thanks in advance. -- Dave Peterson |
#4
|
|||
|
|||
Drop Down Box & Macro
I think I would separate the functions into two pieces.
One would be updating the table. I'd do it directly in the second sheet. But maybe you'd rather use Data|Form. And since the table is resizing, you could use a dynamic name for the data|validation cell. See Debra Dalgeish's site for some nice tips: http://contextures.com/xlNames01.html#Dynamic Then the second part would be using the =vlookup() formulas. A.S. wrote: Hi Dave, I forgot to mention, that there is a catch. The reason I say I need a macro is that I want the data to be changeable & not from a list. Example: My Drop Down Box has countries from A-Z. The categories are population, and let's say internet penetration. Now, when I select Brazil, I input the population and internet penetration, after I do that, then I go back to the drop-down box and select China and input data for China. And I want to be able to do this for whichever country I choose. Any ideas? "Dave Peterson" wrote: You may not need a macro. Say you have a table with all your info on it in sheet2--country name in column A. Then you could use a formula like: =if(a1="","",vlookup(a1,sheet2!a:e,2,false)) You may want to read Debra Dalgleish's notes: http://www.contextures.com/xlFunctions02.html A.S. wrote: Hello, I want to create a macro so that when I select a country from a drop down box, then hidden data for the country appears. For example, I select Argentina from the box, then data will appear on the population, econmic info., etc. However, I can then choose Mexico from the box and the same data appears for Mexico. Thanks in advance. -- Dave Peterson -- Dave Peterson |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Switchboard macro | Karen | General Discussion | 11 | December 14th, 2005 08:20 PM |
Editing a simple macro | Connie Martin | Worksheet Functions | 5 | November 29th, 2005 09:19 PM |
Creating a macro | dk | Page Layout | 10 | November 17th, 2005 04:36 PM |
Need Entry Point 18 Help On Access Executable File | Jeff Conrad | General Discussion | 26 | July 14th, 2004 06:00 AM |
Macro | Nicole | Worksheet Functions | 4 | October 9th, 2003 09:53 PM |