Thread: Macro needed
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Macro needed

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

"Gav123" wrote:

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.

"Joel" wrote:

This should get you started. Not sure what you want to fill cells B to N with.

"Gav123" wrote:

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.