Macro to find and copy data from a list into another sheet

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi everyone,
I have two sheets
1 called "Database"
2 called "Inputs"

Now Database has all my product names and data in it
Product Lookup is in Range D10:D500
Product E
Price F
Size G


So Heres what i want to do
In Sheets Inputs Range G7:G37 In have drop down boxes
If i choose a dropdown box the macro is triggered,

The dropdown box has Product Lookup names

so the macro should, look at cell and see name of Product look up,
find that name in Sheet "Database" range ("D10:D500") and return the Product in column E to Inputs column J, Price to Column M and Size to column P

I know this can be done with formulas but i need it to be done with macros
data must on copy over Values

please help if you can

Thanks

Tony
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi
Try this in Sheet("input") code

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim x As Range
    If Not Intersect(Target, Range("G7:C37")) Is Nothing Then
        With Sheets("Database ").Range("D10:D500")
            Set x = .Find(Target.Value2)
            Range(Target.Address).Offset(, 3) = x.Offset(, 1)
            Range(Target.Address).Offset(, 6) = x.Offset(, 2)
            Range(Target.Address).Offset(, 9) = x.Offset(, 3)
        End With
    End If
End Sub
 
Upvote 0
Solution
you are welcome
And thank you for the feedback
Be happy
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,195
Members
449,072
Latest member
DW Draft

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