title: VBA: How to automatically trigger macro without a button
body: <p>I have made a macro that auto fill the formula on sheet1 whenever the row number of sheet2 is changed. </p>
  
  <p>Is it possible to trigger it automatically without a button when i have any update on sheet2? </p>
  
  <pre><code>Sub Autofill()
  Dim sg As Sheets
  Dim Row As Long
  Dim fillRow As Integer
  
  Application.EnableEvents = False
  Row = Worksheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
  fillRow = Row - 1
  
  Sheets("Sheet1").Select
  Range("A1:E1").Select
  Selection.Autofill Destination:=Range("A1:E" &amp; fillRow), Type:=xlFillDefault
  
  Application.EnableEvents = True
  
  End Sub
  </code></pre>