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
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Watch MrExcel Video

Forum statistics

Threads
1,113,793
Messages
5,544,315
Members
410,602
Latest member
lidovi
Top