thats why i suggested the option with the line above being used and the comment line being disabled. How about the following option
Sub DRP()
' Keyboard Shortcut: Ctrl+d
'
Dim i As Integer
Dim absent As String
Dim match1 As Integer
Dim match2 As Integer
Sheets("DRP").Select
Range("E65536").Select
Selection.End(xlUp).Select
endrow = ActiveCell.Row
absent = " "
i = 2
For i = 2 To endrow
temp = Sheets("DRP").Cells(i, 5).Value
match1 = InStr(1, absent, " " & temp, vbTextCompare)
match2 = WorksheetFunction.CountIf(Sheets("LoadingPlan").Range("b:B"), temp)
If match2 = 0 And temp <> "" And match1 = 0 Then
' Cells(i, 18).Value = "Shortage of this item"
MsgBox "Hix, Shortage of item: " & temp
End If
absent = absent & " " & temp
Next i
End Sub
is that what you want
Regards
Dav
Bookmarks