Related:
- Compare two worksheets and paste differences to another sheet - excel vba
- Compare two worksheets and paste differences to another sheet - excel vba free download ✓ - Forum - Excel
- How to compare two Excel sheets with varying data ✓ - Forum - Excel
- Macro to compare 2 sheets and copy differences ✓ - Forum - Excel
- VBA Compare 2 sheets and output difference to 3rd sheet - Forum - Excel
- Macro to compare two excel sheets ✓ - Forum - Excel
1 reply
Assumption:
There are no empty cells in the name column of the first worksheet you want to compare that have only the login name and dates.
Private Sub CommandButton2_Click()
Set s = Sheets("Sheet1") 'You can rename the sheets to match your sheet names
Set r = Sheets("Sheet2")
Dim i
Dim j
i = 2
j = 2
Do Until s.Range("A" & j) = ""
If s.Range("A" & i) = r.Range("A" & j) And s.Range("B" & i) = r.Range("B" & j) Then
s.Range("C" & i) = r.Range("C" & j)
s.Range("D" & i) = r.Range("D" & j)
s.Range("E" & i) = r.Range("E" & j)
s.Range("F" & i) = r.Range("F" & j)
s.Range("G" & i) = r.Range("G" & j)
s.Range("H" & i) = r.Range("H" & j)
s.Range("I" & i) = r.Range("I" & j)
End If
i = i + 1
j = j + 1
Loop
End Sub
There are no empty cells in the name column of the first worksheet you want to compare that have only the login name and dates.
Private Sub CommandButton2_Click()
Set s = Sheets("Sheet1") 'You can rename the sheets to match your sheet names
Set r = Sheets("Sheet2")
Dim i
Dim j
i = 2
j = 2
Do Until s.Range("A" & j) = ""
If s.Range("A" & i) = r.Range("A" & j) And s.Range("B" & i) = r.Range("B" & j) Then
s.Range("C" & i) = r.Range("C" & j)
s.Range("D" & i) = r.Range("D" & j)
s.Range("E" & i) = r.Range("E" & j)
s.Range("F" & i) = r.Range("F" & j)
s.Range("G" & i) = r.Range("G" & j)
s.Range("H" & i) = r.Range("H" & j)
s.Range("I" & i) = r.Range("I" & j)
End If
i = i + 1
j = j + 1
Loop
End Sub