Hello.
Right now on a user form, I have an If statement that when a part is listed, it checks to see if it's a duplicate. What I would like to do is if the cell color in the range is Yellow (VB colorindex is 6) then it allows for a duplicate entry, but if the cell color is not yellow, then it prevents a duplicate. Right now I am using the following code to prevent all duplicated. Does anyone have any advice?
Thanks
Brad
Right now on a user form, I have an If statement that when a part is listed, it checks to see if it's a duplicate. What I would like to do is if the cell color in the range is Yellow (VB colorindex is 6) then it allows for a duplicate entry, but if the cell color is not yellow, then it prevents a duplicate. Right now I am using the following code to prevent all duplicated. Does anyone have any advice?
Code:
If WorksheetFunction.CountIf(ws.Range("D4:D500", ws.Cells(iRow, 1)), Me.txtPN.Value) > 0 Then
MsgBox "Duplicate Part Number! This part is already on list.", vbCritical
Exit Sub
End If
Thanks
Brad