Dear everyone,
I have the code (work properly), like this:
The above code works to copy missing data of 2 tables compared. When I press button 'Click', the missing data will be copying in E2, like this:
My problem is:
I want to copy the missing data to a new table that I created, but the data cannot be copied start from below header table, like this:
How to fix that problem? Thank you...
I have the code (work properly), like this:
Code:
Sub MyMacro()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim rgnSearch As Range, rngList As Range, rngItem As Range, rngfound As Range
Set ws1 = Sheets("Sheet1")
Set ws2 = Sheets("Sheet2")
Set rgnSearch = ws1.Range("A1", ws1.Cells(Rows.Count, 1).End(xlUp))
Set rngList = ws2.Range("A1", ws2.Cells(Rows.Count, 1).End(xlUp))
For Each rngItem In rgnSearch
With rngList
Set rngfound = .Find(rngItem.Value, LookIn:=xlValues)
If rngfound Is Nothing Then
ws2.Cells(Rows.Count, 5).End(xlUp).Offset(1, 0).Resize(, 3).Value = VBA.Array(rngItem.Value, rngItem.Offset(0, 1).Value, rngItem.Offset(0, 2).Value)
End If
End With
Next
End Sub
My problem is:
I want to copy the missing data to a new table that I created, but the data cannot be copied start from below header table, like this:
How to fix that problem? Thank you...