change trigger from Worksheet_Change to Woorksheet_Calaculate
Results 1 to 4 of 4

Thread: change trigger from Worksheet_Change to Woorksheet_Calaculate
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Mar 2019
    Location
    las vegas
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default change trigger from Worksheet_Change to Woorksheet_Calaculate

    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

  2. #2
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    25,311
    Post Thanks / Like
    Mentioned
    435 Post(s)
    Tagged
    45 Thread(s)

    Default Re: change trigger from Worksheet_Change to Woorksheet_Calaculate

    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?
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  3. #3
    New Member
    Join Date
    Mar 2019
    Location
    las vegas
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: change trigger from Worksheet_Change to Woorksheet_Calaculate

    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.

  4. #4
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    25,311
    Post Thanks / Like
    Mentioned
    435 Post(s)
    Tagged
    45 Thread(s)

    Default Re: change trigger from Worksheet_Change to Woorksheet_Calaculate

    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
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •