change trigger from Worksheet_Change to Woorksheet_Calaculate

williamu

New Member
Joined
Mar 19, 2019
Messages
16
I'm trying to change the trigger from Worksheet_Change to worksheet_calculate cannot get it to work.


Private Sub Worksheet_Change(ByVal target As Range)

If target.Cells.Count <> 1 Then Exit Sub
If target.Address <> "F13" Then Exit Sub
If (target.Value >= 0) And (target.Value < 0) ThenExit Sub

Pictures("Picture 38").Visible = (target.Value>= 0)
Pictures("Picture 40").Visible = (target.Value< 0)
End Sub
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
The Calculate event does not have a "target", it simply triggers whenever any cell on the sheet re-calculates.

Assuming F13 is a formula, do all the cells it relies on, exist in the same sheet?
 
Upvote 0
yes F13 is a formula, yes all the cells it relies on are in the same worksheet, I need F13 to be the target, is there another way to have F13 trigger it besides calculate.
 
Upvote 0
How about
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   Dim KyCell As Range, KyCells As Range

   Set KyCell = Range("F13")
   If Target.Cells.Count <> 1 Then Exit Sub
   On Error Resume Next
   Set KyCells = Union(KyCell, KyCell.Precedents)
   If Not Intersect(Target, KyCells) Is Nothing Then
      Pictures("Picture 38").Visible = (KyCell.Value >= 0)
      Pictures("Picture 40").Visible = (KyCell.Value < 0)
   End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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