information message

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........
 
R

Ron de Bruin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top