find and copy and paste

SoUPERrrMAN

New Member
Joined
Apr 19, 2002
Messages
1
i have a workbook with sheets for each day of the week. on each sheet the left hand column has a persons name and to the right each column is for different data that i have to take from another sheet.
i was wondering how to write a macro to search that other sheet for their name and then search for a columns data and paste it in the cell
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
I just did this one the other day. I recommend runing a loop that uses the VLOOKUP function to find the data you need. With the VLOOKUP, you'll need a variable to represent the name. Then lookup the name in some huge range on the other sheet like A1:FF1000, and for the column use a MATCH method. Example below:

Name Num1 Num2 Num3
Green 3 4 5
Smith 1 2 3
Jackson 3 6 5
Jones 8 7 6

Dim Person as String
Sub LocateLoop()
Sheets("MasterSheet").Select
Range("A2").Select
Do Until NotIsEmpty(ActiveCell)
Person = ActiveCell.Value
ActiveCell.Offset(0,1).Formula = "=VLOOKUP(""" & Person & """,[SheetWithData]!A1:FF1000,MATCH(""Num2"",[SheetWithData]!A1:FF1,0),FALSE)"
ActiveCell.Offset(1,0)
Loop
End Loop
 
Upvote 0

Forum statistics

Threads
1,214,517
Messages
6,119,984
Members
448,935
Latest member
ijat

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