VBA Worksheet Event when cell changes by formula

mizogy

New Member
Joined
Jul 5, 2011
Messages
40
Office Version
  1. 365
Platform
  1. Windows
Hi All

Wondering whether anybody would be able to shed some light to whether it is possible to trigger a worksheet event when a cell changes through formula as opposed to the cell being change manually?

Many thanks,

Mizogy

The code I have so far;


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("AQ11")) Is Nothing And Target.Cells.Value > 0 Then
Exit Sub

Dim a As Variant
a = Range("AQ11")
If a = 0 Then
MsgBox "Country selected has no salary data to base an indexation, therefore data is unstable to use", vbExclamation, "Information Alert"
End If
End If
End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
For worksheet events, only the Calculate event is applicable, but it will not tell you what calculated, or whether the value actually changed, so you need to test that. You may wish to monitor the input cells (if any) instead.
 
Upvote 0
Try

Code:
Private Sub Worksheet_Calculate()
If Range("AQ11").Value = 0 Then MsgBox "Country selected has no salary data to base an indexation, therefore data is unstable to use", vbExclamation, "Information Alert"
End Sub
 
Upvote 0
I appreciate this is a few years old but I want to do the same but across several cells withing a named range.

Is this possible?


TIA
 
Upvote 0

Forum statistics

Threads
1,216,216
Messages
6,129,566
Members
449,517
Latest member
Lsmich

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