Excel - A macro to fill in data automatically

October 2016


I have two worksheets in Excel 2007 and am trying to automatically fill in cells in the 2nd worksheet two based on values in the first worksheet. Both worksheets contain name, last name, address, phone number (no unique identifiers though). Some of these contact details are repeated in worksheet2. Whenever an identical name (first name, last name) is typed into the second worksheet, I would like the contact details fields in worksheet 2(address, phone number, etc) to be filled automatically. Could anyone help with the code?


Here a small sample of the code:

sheet 1 contains data from A1 to D5  

first name last name address phone no.  
a s sssss 123  
a d ddddd 234  
s d ffffffff 345  
f g gggggg 678  

sheet 2 contains data from A1 to B3  

first name last name  
a d  
f g  

in the second sheet in C2 copy this formula  


copy C2 down and to right.  

you get the results like this  

first name last name address phoneno.  
a d ddddd 678  
f g gggggg 678 

Note that

Solved by venkat1926

Related :

This document entitled « Excel - A macro to fill in data automatically » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.