Automated Macros on Formula Value Changing

kRiShNa_96

New Member
Joined
Feb 24, 2017
Messages
2
Hi, I'm new to VBA but for a project I'm working on, the calculations require a series of formulas which have to be manually carried out such as several goal seeks.

So far I have been able to enable them with a series of macros with a worksheet selection change such as below.
Also the macro carries out the goal seek required. This works fine however the problem with the worksheet selection change is that I need to be clicked on the worksheet containing the code in order for the macro to be initiated, however I want the macro to run as soon as the current value is changed.

I have tried a worksheet_change event and it worked, but as the range is for a formula I think I need a worksheet_calculate formula so that it runs whenever the formula value changes. In all of my cases if the value is non zero, I need the relevant macros to run. Could someone help me come up with relevant code for the worksheets?

Kind Regards


Rich (BB code):
 Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Rich (BB code):
Dim found As Boolean
found = False
For Each cell In Range("AH106", "AH107").Cells
If cell.Value = "X" Then
found = True
End If
Next
If found = True Then
Call GoalSeek_T113
Else
'Call GoalSeek_T113'
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.

Forum statistics

Threads
1,215,050
Messages
6,122,868
Members
449,097
Latest member
dbomb1414

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