Advanced Find & Replace

  • Thread starter Thread starter Hendrik.Kleine
  • Start date Start date
H

Hendrik.Kleine

Hi all, your help on this one would be greatly appreciated;

sheet1:

A B C
Name Date data

Sheet 2:

A B(date) C(date) etc...
Name1 data data
Name2 data data
etc..

I'm looking for a code that, when executed, will lookup NAME and DATE from
sheet1 in sheet2,
then replace the data on sheet 2 for the correct name and date with the data
from cell c on sheet1.

I'd be amazed if this were possible. Many thanks for trying!

Happy New Year,
Hendrik
 
Sub marine()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s1.Activate
v1 = Range("A1").Value
v2 = Range("B1").Value
v3 = Range("C1").Value
s2.Activate
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To n
If Cells(i, 1).Value = v1 And Cells(i, 2).Value = v2 Then
Cells(i, 3).Value = v3
End If
Next
End Sub

So if Sheet1 has:

Joe 12/14/2008 123

and Sheet2 has:

Mike 12/24/2008
James 1/5/2009
Joe 12/13/2008
Joe 12/14/2008
Joe 12/15/2008
Fred 3/3/2002

then Sheet2 will be updated:

Mike 12/24/2008
James 1/5/2009
Joe 12/13/2008
Joe 12/14/2008 123
Joe 12/15/2008
Fred 3/3/2002
 
Thanks for your help. It's not exactly what I'm looking for though;

Sheet1 is fine, but,

on sheet2, the name is in column A, the dates are on row 7, horizontally,
not vertical. For example name1 is in cell A20 and the date is in cell K7.
The cell to modify would be K20.

Immensely appreciated if you could continue your advice.

Hendrik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top