Consulting

Results 1 to 3 of 3

Thread: Solved: How to capture cell changes

  1. #1
    VBAX Tutor nst1107's Avatar
    Joined
    Nov 2008
    Location
    Monticello
    Posts
    245
    Location

    Solved: How to capture cell changes

    I can use Workbook_SheetChange to capture when a user or an external link changes the value in a cell, but is there a way to capture when the value of a cell's formula changes, besides using Worksheet_Calculate? Specifically, I'm looking for a way to determine which cell had its value changed by its formula.

  2. #2
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    This prints a message everytime that C1 has its formula re-calculated. A static variable could be used to determine if the value has changed.

    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
        With Target
            On Error Resume Next
            If Application.Intersect(.Dependents, Range("c1")) Is Nothing Then
            Else
                On Error GoTo 0
                MsgBox "The formula in C1 has been re-calculated"
            End If
            On Error GoTo 0
        End With
    End Sub
    Last edited by mikerickson; 01-11-2009 at 12:17 AM.

  3. #3
    VBAX Tutor nst1107's Avatar
    Joined
    Nov 2008
    Location
    Monticello
    Posts
    245
    Location
    Wonderful. Thanks!

Posting Permissions

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