    'Checking if the third part of the Company Document Reference in the column M (CPY Doc Reference 3rd part) match with the corresponding part in the JSM-0241
    Range("Table1[CPY Doc Reference 3rd part]").FormulaR1C1 = _
        "=MID([@[Company Document Reference]],15,3)"
    Range("Table1[CPY Doc Reference 3rd part JSM-0241]").FormulaR1C1 = "=IFERROR(VLOOKUP([Doc Items],'Docs Items-EN'!C[-14]:C[-12],3,FALSE),0)"

    Dim zp As Long, ap As Integer, bp As Integer
        ap = Sheets("VendorDocument").ListObjects("Table1").ListColumns("CPY Doc Reference 3rd part").Index
        bp = Sheets("VendorDocument").ListObjects("Table1").ListColumns("CPY Doc Reference 3rd part JSM-0241").Index
        dl = Cells(Rows.Count, ap).End(xlUp).Row
    For zp = 1 To dl
    If Not ActiveSheet.ListObjects("Table1").DataBodyRange(zp, ap).Value Like "*" & ActiveSheet.ListObjects("Table1").DataBodyRange(zp, bp) & "*" Then
    
    'Applying a red color to the cells in column M (CPY Doc Reference 3rd part) when the value in the column N (CPY Doc Reference 3rd part JSM-0241) is incorrect
    ActiveSheet.ListObjects("Table1").DataBodyRange(zp, ap).Interior.Color = vbRed
    End If
   Next zp