ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Replacing data in a row of sheet1 with data in a row of sheet 2 based on a field in both sheets being the same? (https://www.excelbanter.com/excel-programming/371883-replacing-data-row-sheet1-data-row-sheet-2-based-field-both-sheets-being-same.html)

[email protected]

Replacing data in a row of sheet1 with data in a row of sheet 2 based on a field in both sheets being the same?
 
Here is what I have:
I have 2 sheets named:
(APCURRENT),(CORPCONTACT)

In both sheets I have vendor names as Column A.
I want to look at APCURRENT "vendor names" and if CORPCONTACT "vendor
names" is
the same, I want to replace the APCURRENT B-H(Columns) with the
B-H(Columns) of CORPCONTACT. But only if they are equal if not ignore.

Any help would be greatly appreciated.
Thanks


[email protected]

Replacing data in a row of sheet1 with data in a row of sheet 2 based on a field in both sheets being the same?
 
HERE IS WHAT I HAVE RIGHT NOW THAT WILL CHANGE THE FIRST ROW OF
APCURRENT TO THE INFORMATION IN CORPCONTACT, but would like it look the

whole sheet and change every instance of the first command being true.

Sub COPYDATA()

Dim APCURRENT As Worksheet
Dim CORPCONTACT As Worksheet

Set APCURRENT = ThisWorkbook.Sheets(1)
Set CORPCONTACT = ThisWorkbook.Sheets(2)

If APCURRENT.Range("B2").Value = CORPCONTACT.Range("A2").Value Then

APCURRENT.Range("C2").Value = CORPCONTACT.Range("B2").Value

APCURRENT.Range("D2").Value = CORPCONTACT.Range("C2").Value

APCURRENT.Range("e2").Value = CORPCONTACT.Range("d2").Value

APCURRENT.Range("f2").Value = CORPCONTACT.Range("e2").Value

APCURRENT.Range("g2).Value = CORPCONTACT.Range("f2").Value

End If

End Sub



All times are GMT +1. The time now is 07:54 PM.

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