ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Cell, Paste based on a match. (https://www.excelbanter.com/excel-programming/393932-copy-cell-paste-based-match.html)

Pete

Copy Cell, Paste based on a match.
 
I am hoping someone can help,

I want to be able to copy a specific cell ("C3") in sheet1 and paste it to
another cell (Z?) in sheet2 based on a match of cell ("A3") in sheet1 to a
same matching record in sheet 2 out of column A, but the row number might be
2, 43, 76......

Thanks in advance for any help.
--
Pete

joel

Copy Cell, Paste based on a match.
 
Sub copyandpaste()

Sheets("Sheet2").Activate

LastRowSh2 = Cells(Rows.Count, "A").End(xlUp).Row
Set FindRange = Range(Cells(1, "A"), Cells(LastRowSh2, "A"))

OldValue = Sheets("Sheet1").Range("A3")
NewValue = Sheets("Sheet1").Range("C3")

FindRange.Replace What:=OldValue, Replacement:=NewValue

End Sub

"Pete" wrote:

I am hoping someone can help,

I want to be able to copy a specific cell ("C3") in sheet1 and paste it to
another cell (Z?) in sheet2 based on a match of cell ("A3") in sheet1 to a
same matching record in sheet 2 out of column A, but the row number might be
2, 43, 76......

Thanks in advance for any help.
--
Pete


Pete

Copy Cell, Paste based on a match.
 
Thanks Joel, this seamed to do the trick.
--
Pete


"Joel" wrote:

Sub copyandpaste()

Sheets("Sheet2").Activate

LastRowSh2 = Cells(Rows.Count, "A").End(xlUp).Row
Set FindRange = Range(Cells(1, "A"), Cells(LastRowSh2, "A"))

OldValue = Sheets("Sheet1").Range("A3")
NewValue = Sheets("Sheet1").Range("C3")

FindRange.Replace What:=OldValue, Replacement:=NewValue

End Sub

"Pete" wrote:

I am hoping someone can help,

I want to be able to copy a specific cell ("C3") in sheet1 and paste it to
another cell (Z?) in sheet2 based on a match of cell ("A3") in sheet1 to a
same matching record in sheet 2 out of column A, but the row number might be
2, 43, 76......

Thanks in advance for any help.
--
Pete



All times are GMT +1. The time now is 09:52 AM.

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