information message

  • Thread starter Thread starter K
  • Start date Start date
K

K

Hi, what macro do i need to creat message that this value is not in
the list. like if i put some value in any cell of coloumn A in sheet 1
and it looks up that value into coloumn B of sheet 2 and if the value
is not there the message should pop up that this value is not in the
list. the macro should just bring the message and do nothing else and
you can still put new value in coloumn A.
Plese is there anybody can help. Thanks........
 
Hi K

You can use this event in the sheet module of Sheet1

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
If Application.WorksheetFunction.CountIf(Sheets("Sheet2").Columns("B"), Target.Value) = 0 Then
MsgBox "not exist in Sheet2"
End If
End If
End Sub
 
Back
Top