Experts Exchange connects you with the people and services you need so you can get back to work.
Dim dic As Object
Dim rng As Range
Dim cel As Range
Set dic = CreateObject("Scripting.Dictionary")
dic.Add "message1", "msg1"
dic.Add "message2", "msg2"
Set rng = Range("a5:a7")
Range("a5") = "garbage"
Range("a6") = "message1"
Range("a7") = "message2"
For Each cel In rng.Cells
If dic.Exists(cel.Value) Then
MsgBox dic.Item(cel.Value) & " not defined"
Set dic = Nothing
Open in new window
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.