amrubinissa
New Member
- Joined
- Feb 17, 2022
- Messages
- 6
- Office Version
- 2021
- 2019
- 2016
- Platform
- Windows
- Mobile
Hello
I'm trying to modify an incomplete to do this:
1- IF (cells in column A & J together in sheet 1) match (cells in columns A & J together in sheet 2) THEN replace whole sheet 2 row from sheet 2
The incomplete code that I have does this:
2- IF (cells in column in sheet 1) match (cells in columns A in sheet 2) THEN replace whole sheet 2 row from sheet 2
If anyone knows how to add to code to instruct statement (2) rather than just statement (1)
I'm trying to modify an incomplete to do this:
1- IF (cells in column A & J together in sheet 1) match (cells in columns A & J together in sheet 2) THEN replace whole sheet 2 row from sheet 2
The incomplete code that I have does this:
2- IF (cells in column in sheet 1) match (cells in columns A in sheet 2) THEN replace whole sheet 2 row from sheet 2
If anyone knows how to add to code to instruct statement (2) rather than just statement (1)
VBA Code:
Sub UpdateSheet2()
Dim i As Long
Dim f As Range, c As Range
Application.ScreenUpdating = False
With Sheets("Sheet2")
For Each c In .Range("A1", .Range("A" & Rows.Count).End(3))
Set f = Sheets("Sheet1").Range("A:A").Find(c.Value, , xlValues, xlWhole, , , False)
If Not f Is Nothing Then
f.EntireRow.Copy .Range("A" & c.Row)
End If
Next
End With
Application.CutCopyMode = False
End Sub