VBA code to display a set of Cities when selected a cell

kinirobin

New Member
Joined
Jan 10, 2012
Messages
18
Hi,

I was looking for a solution (VBA code or Formula) where it gets me back a list of cities associated to a cell when clicked on it. For example: when I select cell "Martin" automatically Boston, New York and Washington should appear, same way when Elena is selected a bunch of other cities should reflect.

ElenaBoston
RoseNew York
MartinWashington
King

<tbody>
</tbody>

Can anyone please help me find a solution for this.

Best Regards,
KINIROBIN
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Where are these "city associations" stored?
 
Upvote 0
Hi Joe4,

thanks for looking into this.

I don't have a repository to store the city details. I am having the details stored in a excel spreadsheet as of now.

I am imagining that we can have a common excel workbook for all the users which should host the capabilities of retrieving cities(VBA code) by looking up to the spreadsheet which has all the details or can't we have both in a same workbook, that is, the cities and the VB code to retrieve the cities in the same workbook.

Regards,
Kinirobin
 
Upvote 0
How exactly is this sheet of details structured?

One way to return what you want is to use Filters, where the name that is selected is used as a Filter on your list, and it returns the corresponding records.
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,273
Members
448,559
Latest member
MrPJ_Harper

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top