I've have come close to solving my original dilemma: Compare Two Sheets (A and B) and copy & hilight differences to bottom of B
NOTE: I did try to use XLS2BB add-in and it locks up my EXCEL program.
In breaking down my original problem, I have come to this road block: some data is not copying from the first sheet to second sheet when I run compare code.
I am comparing row A in Summary sheet against row B in Tutoring sheet and copying differences (new data) to (B). The problem is when I run the code, some of the values from row A Summary are repeated in Tutoring (B) while some data is not copied at all.
The names in Yellow should be the ones added, but when I run the code, some data is copied over while other cells are not.
Summary sheet
Tutoring sheet View attachment 43932
Here's the code I have so far.
Please provide me some assistance with my code or even some different method to solve my problem. I am soooo close!
Thanks folks!
NOTE: I did try to use XLS2BB add-in and it locks up my EXCEL program.
In breaking down my original problem, I have come to this road block: some data is not copying from the first sheet to second sheet when I run compare code.
I am comparing row A in Summary sheet against row B in Tutoring sheet and copying differences (new data) to (B). The problem is when I run the code, some of the values from row A Summary are repeated in Tutoring (B) while some data is not copied at all.
The names in Yellow should be the ones added, but when I run the code, some data is copied over while other cells are not.
Summary sheet
Here's the code I have so far.
VBA Code:
Private Sub Find_Match_Summary()
On Error Resume Next
Dim ws1 As Worksheet, ws2 As Worksheet
Dim i As Integer, j As Integer, a As Integer, b As Integer
Set ws1 = ActiveWorkbook.Sheets("Summary") ' Column A relates to a = row 4 and i = 4
a = ws1.Cells(ws1.Rows.Count, 1).End(xlUp).Row ' Last filled cell in Column A of Summary
i = 4 ' Beginning row of compare for Summary
Set ws2 = ActiveWorkbook.Sheets("Tutoring Attendance") ' Column B relates to b = row 5 and j =5
b = ws2.Cells(ws1.Rows.Count, 2).End(xlUp).Row ' Last filled cell in Column B of Tutoring
j = 5 ' Beginning row of compare for Tutoring
For i = 4 To a
ws1.Activate
ws1.Range(i, 1).Select ' Select first cell to compare
If Trim(ws1.Cells(i, 1).Value2) = Trim(ws2.Cells(j, 2).Value2) Then
MsgBox "Cells are True for = " & ws2.Cells(j, 2).Value2
Else
ws1.Range("A" & i, "B" & i).Copy ' Copy the two cells of data
ws2.Activate ' Tutoring Sheet
b = ws2.Cells(ws1.Rows.Count, 2).End(xlUp).Row ' Last filled cell in Column B of Tutoring
ws2.Cells(b + 1, 2).Select ' First empty cell in Column B of Tutoring
ws2.Range("B50").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues ' Paste VALUES only to new rows
MsgBox "Verify " & ws2.Cells(j, 2).Value2 & " was copied over" ' Used to verify correct Value was copied over
End If
Next i
Application.CutCopyMode = False
ws1.Activate ' Tutoring Attendance sheet activated
MsgBox "Find_Match_Summary - Dun!"
End Sub
Please provide me some assistance with my code or even some different method to solve my problem. I am soooo close!
Thanks folks!