Advertisement
Guest User

AutoUpdate

a guest
Jul 27th, 2015
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'This program will analyze an excel spreadsheet for a change in a specific column
  2. 'and then update subsequent cells
  3.  
  4.  
  5. 'pre-built function that analyzes changes in cells
  6. Sub Worksheet_Change(ByVal Target As Range)
  7.     'declare range variables
  8.    Dim WatchRange As Range
  9.     Dim IntersectRange As Range
  10.    
  11.     'set the ranges
  12.    Set WatchRange = Range("D:D")
  13.     Set IntersectRange = Intersect(Target, WatchRange)
  14.    
  15.     'conditional to execute code if change occurs
  16.    If IntersectRange Is Nothing Then
  17.         'Do Nothing
  18.    Else
  19.        
  20.         Call MyCustomFunction
  21.     End If
  22. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement