View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] brian.baulsom@gmail.com is offline
external usenet poster
 
Posts: 4
Default Start a macro when a vlooup formula shows a new value

Here is a way
Code:
'===========================================================
'- CHECK FOR CHANGE IN A VLOOKUP VALUE
'- WE CANNOT CHECK FOR THE CHANGE DIRECTLY (eg.TargetValue)
'- BECAUSE IT DOES NOT FIRE A CHANGE EVENT ITSELF
'===========================================================
'- code runs whenever a change is made in the ws
'- Goes into ws code module. Right click tab. view code
'- Brian Baulsom November 2008
'============================================================

Private Sub Worksheet_Change(ByVal Target As Range)
    '- Saves the value in this subroutine
    Static A3value As Variant
    '--------------------------------------------------------
    '- check if the saved value is the same as it was
    If A3value < Range("A3").Value Then
        A3value = Range("A3").Value
        MsgBox ("A3 has changed to " & A3value)
    End If
End Sub