Macro needed

  • Thread starter Thread starter Gav123
  • Start date Start date
G

Gav123

Hi,

I'm hoping someone can help me with this...

Using XL2003

I have to workbooks lets call them book1 and book2. I need a macro that
looks through column D on book1 and matches numbers to column D on book2, if
a match is found on book2 and Coulumn G in that row has text in the cell,
copy the text from Column G and Column H and paste this into book1 Column I
and N (book2 Column G to book1 Column I and book2 Column H to book1 Column N)

Then fill the range of cells on book2 from column B to N on that specific row.

Book1 is shared workbook but book2 isn't.

I hope I have explained this clearly enough.

Appreciate any help that is provided.

Thanks in advance,

Gav.
 
Hi Joel,

Thanks fo rthe reply but What should get me started??

Forgot to add that I would like the cells format to be a green fill.

Regards,

Gav.
 
Which cells should be green?
What should be put in cells B to N?

Sub compare_data()

With Workbooks("Book1.xls").ActiveSheet
RowCount = 1
Do While .Range("D" & RowCount) <> ""
Data = .Range("D" & RowCount)
With Workbooks("Book2.xls").ActiveSheet
Set c = .Columns("D:D").Find(what:=Data, _
LookIn:=xlValues, lookat:=xlWhole)
If Not c Is nothiing Then
If .Range("G" & c.Row) <> "" Then
Col_G = .Range("G" & c.Row)
Col_H = .Range("H" & c.Row)
'Need to add the fill data??????????
End If
End If
End With
.Range("I" & RowCount) = Col_G
.Range("N" & RowCount) = Col_H
RowCount = RowCount + 1
Loop
End With
End Sub
 
Back
Top