ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Advanced Find & Replace (https://www.excelbanter.com/excel-programming/421978-advanced-find-replace.html)

Hendrik.Kleine

Advanced Find & Replace
 
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

Gary''s Student

Advanced Find & Replace
 
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

--
Gary''s Student - gsnu200823


"Hendrik.Kleine" wrote:

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


Hendrik Kleine

Advanced Find & Replace
 
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

"Gary''s Student" wrote:

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

--
Gary''s Student - gsnu200823


"Hendrik.Kleine" wrote:

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


aamerrasheed

Advanced Find & Replace
 
Hi,

You can easily get sheet2 using pivot table. Put the names to row, dates to
column and "Sum of data" to values.


Hendrik Kleine wrote:
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

Sub marine()
Set s1 = Sheets("Sheet1")

[quoted text clipped - 57 lines]
Happy New Year,
Hendrik




All times are GMT +1. The time now is 12:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com