Code for pop-up with specific text

wzde14

New Member
Joined
Aug 3, 2017
Messages
3
Hi all,

I've been going through forum posts quite a bit today for some code to show a pop-up message when specific text in is any cell of one column. Probably really simple but I've gone around in circles. What I's like is for a pop-up message to display when the a formula gives me specific text.

Currently, I've been trying:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim rng As Range
Set rng = Range("AJ:AJ")
If Not Intersect(Target, rng) Is Nothing Then
If Target = "CANCEL EMAILS" Then MsgBox "Need to cancel emails"
End If
Set rng = Nothing


End Sub

It only works when the text is typed in and not when the text shows because of the formula...

The formula I'm using in AJ is: =IF(OR(AF2="By post",AF2="Primary outcome over phone"),"CANCEL EMAILS",IF(AF2="Online","N/A",IF(AF2="DNA","N/A",""))) so when any cell in this column (AJ) says "CANCEL EMAILS", I'd like a pop-up message to say "Need to cancel emails". I've tried lots of different codes, on workbook and worksheet change sheets but no joy. The tab/sheet name is "S4 Database" if needed. Any help appreciated.

I need it to pop-up whenever the formula makes the text display.

Thanks for any help with this,
Adele
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
I believe recalculation of a formula does not trigger the change event to run a macro. You will need to check of AF2 changed and if it equals "By post" or "Primary outcome over phone"
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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