Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Macro for autofill a cell based on a value in a different sheet

0

Hello,

I'm having a hard time trying to find a macro for the following use:

Taking in consideration the example (http://imgur.com/a/JqeQW), consider that i have in the "sheet 1" the table with the columns Country and Food.

In the sheet 2, i have two columns named Country#1 and Food#1. The macro i want, needs to autofill the Food#1 cell that is associated with the right text in Country#1 cell, via the drop down list.

Example: When i select "Madrid" in Country#1, it needs to autofill the Food#1 with the text "Tapas and tortillas".

Thank you for all the help.

Best regards,
Luís

Answer
Discuss

Answers

0

This is a simple formula; no macro needed.

=VLOOKUP(A3,A1:B2,2,FALSE)

A3 contains the drop down list and A1:B2 is the table.

To put on a separate sheet, it would look like this:

=VLOOKUP(A3,Sheet1!A1:B2,2,FALSE)

Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login