title: ByVal with a range in which formulas are used.
body: <pre><code>Private Sub Worksheet_Change(ByVal Target As Range)
  
  'Hvis du på noget tidspunkt tilføjer flere rows, så sig til.
  Application.EnableEvents = False
  If Not Intersect(Range("B27:B33"), Target) Is Nothing Then
      Target.Offset(, 1).Formula = "=UDF_Now()"
  End If
  Application.EnableEvents = True
  End Sub
  </code></pre>
  
  <p>I am using the following VBA code to execute my user defined function whenever a cell value in the Range("B27:B33") changes. </p>
  
  <p>This works fine, as long as I am changing the cell values in the range manually. The issue is now that I want this macro to work for a given range that is made up by formulas. Whenever I change any of the precedents, a cell value of the range changes, but my macro does not execute. </p>
  
  <p>I want this to work with formulas, so that the macro gets executed whenever I change a precedent and thus change the values of the cells within the range.</p>
  
  <p>I hope this is useful explanation. </p>