PopUp a Message if Selected Value Exist in a Table

sudhishpt

New Member
Joined
Aug 4, 2014
Messages
2
I have a list in Sheet1 in below format
ColA ColB
abc 1,2
cde 3,4

In Sheet2, I added a dropdown list to the range C1:K10 and the list contains value abc, cde, dfg. This list allow selection of multiple values in the same cell For ex, cell C1 can have value abc, cde; ce;; C2 can have value dfg etc... When I select a value from dropdown list in Sheet2, it should check whether the value exist in ColA of Sheet1 and if yes, popup a message with the respective value from ColB of Sheet1. For ex:, When I first select abc in cell C1, MsgBox display 1,2 and then when I select cde in cell C1, MsgBox display 3,4. And the value of C1 will be abc, cde.

I already have the code written for multi value selection from list and it is working fine. I am looking for help on getting the MsgBox display correct.
 
I managed to develop the script and the below code working fine for my requirement. Updating the thread as it may help others...

Private Sub Worksheet_Change(ByVal Target As Range)
' PopUp a Message if Selected Value Exist in a Table
Application.EnableEvents = True
Dim Cell1 As Range, Cell2 As Range
Dim ToChk As String
Dim i As Integer, j As Integer
If Not Intersect(Target, Columns("C:K")) Is Nothing Then
For Each Cell1 In Intersect(Target, Columns("C:K"))
For i = 2 To 8
ToChk = "*" & Cells(i, 21) & "*"
If Cell1.Value Like ToChk Then MsgBox "Message to Deisplay ==> " & Cells(i, 22), vbExclamation, "Message Box Title"
Next i
Next
End If
End Sub

Note- One change I made from the initial requirement is that now I am using only one Sheet. The table is created in the same sheet with the value to be check is in Column U and the Value to be displayed in MsgPopUp is in Column V
 
Upvote 0

Forum statistics

Threads
1,226,859
Messages
6,193,390
Members
453,792
Latest member
Vic001

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top