finding and copying matches

greenparrot

New Member
Joined
Jan 30, 2004
Messages
41
Hi Guys and Girls

i'm stuck with a macro related problem

i have 2 rows of data on different worksheets (Forecasts and Order Figures)on the same workbook.

i need to find the matching "journey no's" which are on Row B on the forecasts sheet and row G on the Order figures sheet, if it finds a match to copy the data from 2 cells away to the matching number, i.e C45 and the paste it onto the orders sheet next to the matching journey no. there

myprodrow = Sheets("Forecast").Range("B4").CurrentRegion.Rows.Count
For y = 1 To myprodrow
If Sheets("Forecast").Range("B" & myprodrow).Value = Sheets("Predicted Figures Update").Range("G" & y).Value Then
Sheets("Forecast").Range("D" & y).Copy
Sheets("Predicted Figures Update").Select
Sheets("Predicted Figures Update").Range("H" & myprodrow).Select
ActiveSheet.Paste
myprodrow = myprodrow + 1

End If
Next y

that was my first attempt, i hope from my code you can realise what i'm trying to achieve, not very good at if statments :oops: :cry:

one problem i have encounted, is that Row B contains no blank cells, whereas RowG does, as that worksheet is used as an ordering template


thanks very much in advance

GP
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,214,954
Messages
6,122,462
Members
449,085
Latest member
ExcelError

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