I need to update two columns comparing sheet1 and sheet2.
Sheet1
Sheet2
This script works perfectly:
>>> use - code tags <<<
I have beautifully updated the last two columns.
Sheet2
Right now, I need to update only two columns between Sheet3 and Sheet4.
Sheet3
Sheet4
This script works, but it is updating the last 5 columns.
I need to update only two -> G and H
Could you guys help me modify the below script to have updated only columns G and H?
>>> use code - tags <<<
Sheet1
Sheet2
This script works perfectly:
>>> use - code tags <<<
Code:
Sub DATA1()
Const L = 2
Dim Rf As Range, Rg As Range
Application.ScreenUpdating = False
With Sheet1.Cells(1).CurrentRegion.Columns
Set Rg = .Item(1): F& = .Count - L + 1
End With
With Sheet2.Cells(1).CurrentRegion
C& = .Columns.Count - L + 1
For R& = 2 To .Rows.Count
Set Rf = Rg.Find(.Cells(R, 1).Value, , xlValues, xlWhole)
If Not Rf Is Nothing Then Rf(1, F).Resize(, L).Copy .Cells(R, C)
Next
End With
Set Rf = Nothing: Set Rg = Nothing
End Sub
I have beautifully updated the last two columns.
Sheet2
Right now, I need to update only two columns between Sheet3 and Sheet4.
Sheet3
Sheet4
This script works, but it is updating the last 5 columns.
I need to update only two -> G and H
Could you guys help me modify the below script to have updated only columns G and H?
>>> use code - tags <<<
Code:
Sub DATA1()
Const L = 5
Dim Rf As Range, Rg As Range
Application.ScreenUpdating = False
With Sheet3.Cells(1).CurrentRegion.Columns
Set Rg = .Item(1): F& = .Count - L + 1
End With
With Sheet4Cells(1).CurrentRegion
C& = .Columns.Count - L + 1
For R& = 2 To .Rows.Count
Set Rf = Rg.Find(.Cells(R, 1).Value, , xlValues, xlWhole)
If Not Rf Is Nothing Then Rf(1, F).Resize(, L).Copy .Cells(R, C)
Next
End With
Set Rf = Nothing: Set Rg = Nothing
End Sub
Last edited by a moderator: