Superbum138

New Member
Joined
Dec 1, 2017
Messages
2
I am trying to get a message box to fire automatically based on a cell value. Here is the setup:

I have a "configurator" tab (Sheet 2) that has an ActiveX drop down box with a list of names that corresponds to a table of names/job titles on a logic tab (Sheet 3). When you select your name on the ActiveX control the, cell link changes the value based on the name selected i.e. if the third name is selected the control will put 3 in the linked cell. This value is then used by a Vlookup to add the person's name and title to a output letter. There is no issue with this function.

What I would like to do is make the sheet fire a message box when a specific user is selected from the drop down box. If Jon Doe was the 17th on the list then I want a message box to fire that says Hello Jon Doe!

What I did was link a cell on the configurator sheet to the ActiveX cell link value on the logic sheet so whatever number was displayed on the logic sheet would also be displayed on the configurator sheet so that my VBA code could run within that sheet and not have to call other sheets.

The issue resides that the cell I am trying to use to fire the message box contains the formula =Logic!D1627 so being a formula driven value I cannot simply use Worksheet_Change(ByVal Target As Range) as this requires a manual change to trigger.

I have the code:

Private Sub Worksheet_Calculate()
If [G14] = 17 Then
MsgBox "Hello Jon Doe!"
End If
End Sub


Which works but it fires every time you click anywhere in the sheet now. How can I have this message box fire only once unless that value in G14 changes again?

I have tried:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim A As Range
Set A = Range("G14")
If Intersect(Target, A) Is Nothing Then Exit Sub
If Target.Value = 17 Then
MsgBox "Hello Jon Doe!"
End If
End Sub

But this requires a manual change not a formula driven value.

I am stumped.
 

ranman256

Well-known Member
Joined
Jun 17, 2014
Messages
1,808
instead of INTERSECT, wouldnt you just check for that 1 cell to change:

if Target .address = "$G$14" then msgbox "Hello Jon Doe"


 

Superbum138

New Member
Joined
Dec 1, 2017
Messages
2
Maybe I am having a slow day but is this what you are talking about?

Private Sub Worksheet_Change(ByVal Target As Range)
Dim A As Range
Set A = Range("G14")
If Target.Address = "$G$14" Then
If Target.Value = 17 Then
MsgBox "Hello Jon Doe!"
End If
End Sub

That didn't seem to work. Keep in mind that that the value in G14 is formula driven coming from my logic sheet so I was under the impression a Worksheet_change wouldn't work as that has to be a manual change.
 

Forum statistics

Threads
1,082,316
Messages
5,364,483
Members
400,802
Latest member
RichBRich

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top