Hi there! So on this 2 sheet of data, I would like to compare between them and show the missing data onto a new sheet. However, with the code i have, it deletes the data from sheet3. Is there any way I can edit it such that the missing data will be pasted onto a new sheet instead?
VBA Code:
Private Sub CommandButton1_Click()
Dim sht1 As Worksheet
Dim sht2 As Worksheet
Dim sht3 As Worksheet
Dim c1row As Long
Dim c2row As Long
Dim C2TotalRows As Long
Dim CustID As String
Dim NoDups As Long
Set sht1 = Worksheets("Sheet3")
Set sht2 = Worksheets("Sheet4")
Set sht3 = Worksheets("Sheet5")
sht2.Activate
C2TotalRows = Application.CountA(Range("A:A"))
c1row = 2
Do While sht1.Cells(c1row, 1).Value <> ""
CustID = sht1.Cells(c1row, 1).Value
For c2row = 2 To C2TotalRows
If CustID = Cells(c2row, 1).Value Then
sht1.Activate
Rows(c1row).Delete
NoDups = NoDups + 1
c1row = c1row - 1
sht2.Activate
Exit For
End If
Next
c1row = c1row + 1
Loop
End Sub