MurraySMTH
Board Regular
- Joined
- Jun 30, 2020
- Messages
- 81
- Office Version
- 2016
- Platform
- Windows
Hello all,
I am having trouble with my code. I am trying to write a code that recognizes that Sheet 4 column A&B match each other though they contain different data.
So if column A on "sheet 4" and column J on sheet "Template upload" match, then paste column B on Sheet 4 to replace column J on Sheet "template upload".
Sheet 4 Sheet "Template Upload"
My code better explains the method i am going for.
I am having trouble with my code. I am trying to write a code that recognizes that Sheet 4 column A&B match each other though they contain different data.
So if column A on "sheet 4" and column J on sheet "Template upload" match, then paste column B on Sheet 4 to replace column J on Sheet "template upload".
Sheet 4 Sheet "Template Upload"
My code better explains the method i am going for.
VBA Code:
Sub LocationCodes_to_ColumnJ()
a = Worksheets("Sheet4").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a
Next
If Worksheets("Sheet4").Cells(i, 1).Value = Worksheets("Sheet4").Cells(i, 2).Value Then
Worksheets("Sheet4").Cells(i, 2).Value = Worksheets("Template Upload").Cells(i, 10).Value
Worksheets("Sheet4").Cells(i, 2).Copy
Destination = Worksheets("Template Upload").Cells(i, 10)
End If
End Sub