The matched sheet has now values from both sheets, but I can not do the same for the unmatched as the name says, if they values do not match from both sheets, I can not copy from both sheets either.
It is really hard to code as you have many blanks with just values in a column, it would be easier to use the next empty row, but most of your data are empty. I have also copied the entire row in case you wanted the other rows too. If you just wanted to copy only the value, replace these lines
c.Resize(, 7).Copy um.Cells(NR, 4).Resize(, 7)
with
and these two lines
c.Resize(, 7).Copy um.Cells(NR, 4).Resize(, 7)
c2.Resize(, 7).Copy um.Cells(NR + 1, 4).Resize(, 7)
with
c.Copy um.Cells(NR, 4)
c2.Copy um.Cells(NR + 1, 4)
Sub find_events()
Dim c2 As Range, c As Range, LR As Long, um As Worksheet
Set um = Sheets("result unmatched")
Application.ScreenUpdating = 0
Application.EnableEvents = 0
NR = 3
With Sheets("ldn")
LR = .UsedRange.Rows.Count
For Each c In .Range("D2:D" & LR)
If Trim(c.Value) <> vbNullString Then
Set c2 = Sheets("fpl").Columns(3).Find(c.Value, , , 1)
If c2 Is Nothing Then
c.EntireRow.Interior.Color = vbRed
c.Resize(, 7).Copy um.Cells(NR, 4).Resize(, 7)
NR = NR + 1
End If
End If
Next
End With
Call find_events1
Application.ScreenUpdating = 1
Application.EnableEvents = 1
End Sub
Sub find_events1()
Dim c2 As Range, c As Range, LR As Long, um As Worksheet
Set um = Sheets("result matched")
Application.ScreenUpdating = 0
Application.EnableEvents = 0
NR = 3
With Sheets("ldn")
LR = .UsedRange.Rows.Count
For Each c In .Range("D2:D" & LR)
If Trim(c.Value) <> vbNullString Then
Set c2 = Sheets("fpl").Columns(3).Find(c.Value, , , 1)
If Not c2 Is Nothing Then
c.EntireRow.Interior.Color = vbGreen
c.Resize(, 7).Copy um.Cells(NR, 4).Resize(, 7)
c2.Resize(, 7).Copy um.Cells(NR + 1, 4).Resize(, 7)
NR = NR + 1
End If
End If
Next
End With
Application.ScreenUpdating = 1
Application.EnableEvents = 1
End Sub
Bookmarks