title: Worksheet_SheetChange not working
body: <p>I can't for the life of me get this code to work properly</p>
  
  <p>I want this sheet to wait 5 minutes after a change has been made and then re-sort everything. I am new to VBA coding (haven't done it in many years and I've forgotten everything)</p>
  
  <p>The code works great (aside from repositioning the screen after it runs) but only works when i run it with F5, instead of running whenever a change is made.</p>
  
  <p>In the Sheet:</p>
  
  <pre><code>Private Sub Workbook_BeforeClose(Cancel As Boolean)
  Call TimeStop
  End Sub
  
  Private Sub Worksheet_Open(ByVal Wb As Workbook)
  Application.EnableEvents = True
  Call TimeSetting
  End Sub
  
  Private Sub Worksheet_SheetChange(ByVal Target As Range)
  Call TimeStop
  Call TimeSetting
  End Sub
  </code></pre>
  
  <p>In the Module:</p>
  
  <pre><code>Dim CurrentTime As Date
  Dim SelectWorksheet As Range
  
  Sub TimeSetting()
  CurrentTime = Now + TimeValue("00:00:03")
  On Error Resume Next
  Application.OnTime EarliestTime:=CurrentTime, _
    Procedure:="SortFile", Schedule:=True
  End Sub
  
  Sub TimeStop()
  On Error Resume Next
  Application.OnTime EarliestTime:=CurrentTime, _
    Procedure:="SortFile", Schedule:=False
  End Sub
  
  Sub SortFile()
  ActiveWorkbook.Worksheets("Daily").Sort.SortFields.Clear
  ActiveWorkbook.Worksheets("Daily").Sort.SortFields.Add Key:=Range("B:B") _
      , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
  ActiveWorkbook.Worksheets("Daily").Sort.SortFields.Add Key:=Range("D:D") _
      , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
  With ActiveWorkbook.Worksheets("Daily").Sort
      .SetRange Range("Daily")
      .Header = xlYes
      .MatchCase = False
      .Orientation = xlTopToBottom
      .SortMethod = xlPinYin
      .Apply
  End With
  End Sub
  </code></pre>
  
  <p>I took this code from another source (<a href="https://www.extendoffice.com/documents/excel/3921-excel-save-and-close-workbook-after-inactivity.html" rel="nofollow noreferrer">https://www.extendoffice.com/documents/excel/3921-excel-save-and-close-workbook-after-inactivity.html</a>) and modified it for my purposes</p>