Hi guys, the below code should search my range for an existing value a return a msgbox if it does
'Check Record Does Not Already Exist
If Application.CountIf(Range("Staff Numbers"), txtstaffno.Value) > 0 Then
MsgBox "Staff Number Already Exists.", vbExclamation, "Error"
Me.txtstaffno.SetFocus
Exit Sub
End If
However I just cant get it to work, please help
'Check Record Does Not Already Exist
If Application.CountIf(Range("Staff Numbers"), txtstaffno.Value) > 0 Then
MsgBox "Staff Number Already Exists.", vbExclamation, "Error"
Me.txtstaffno.SetFocus
Exit Sub
End If
However I just cant get it to work, please help