Private Sub CommandButton1_Click()

'IF the ID Code in Cloumn D in Notes is blank ("") or does not match the list of ID codes in sheet"ID CODES"
'then copy and past the entire row of the ID code into the "Print sheet" in the next available row

    Dim lRow1 As Long
    Dim lRow2 As Long
    Dim l As Long
    Dim ll As Long
    Dim strTest As String
    Dim ws1 As Worksheet
    Dim ws2 As Worksheet
    Dim ws3 As Worksheet
    
    Set ws1 = Sheets("Notes")
    Set ws2 = Sheets("ID Codes")
    Set ws3 = Sheets("Print Sheet")
    lRow1 = ws1.Range("D65536").End(xlUp).Row
    lRow2 = ws2.Range("A65536").End(xlUp).Row
    
    For l = 2 To lRow1
        strTest = ws1.Range("D" & l).Value
        For ll = 2 To lRow2
            If ws2.Range("A" & ll).Value = strTest Then
                ws1.Range("A" & l).EntireRow.Copy Destination:=ws3.Range("D65536").End(xlUp).Offset(1, 0)
            End If
        Next ll
    Next l

End Sub