Please test using the attached workbook.
Put copy of your data into Sheet1 and run the macro.
How it works
UserDate variable captured from user input (input box)
Calculates last row number based on columnH - there must not be any blank cells in columnH
Blank cells in columnI are replaced with values from columnH
ColumnJ (=Ageing) is added, value = UserDate - columnI
Sheet named ">90" is created (sheet will be deleted if it already exists to avoid errors)
Using "data filter" ageing over 90 days is copied to new sheet
Using "data filter" rows with negative ageing are deleted
Sub Ageing()
'declare variables
Dim ws1 As Worksheet, ws2 As Worksheet
Dim i As Integer
Dim LastRow As Long
Dim UserDate As Date
Set ws1 = ActiveSheet
UserDate = Application.InputBox("Please input ageing date", "User Date", FormatDateTime(Date, vbShortDate), Type:=1)
'determine number of last row of data
With ws1
LastRow = Range("H2").End(xlDown).Row
'replace blank cells in columnI
For i = 2 To LastRow
If .Cells(i, 9) = "" Then
.Cells(i, 9).Value = .Cells(i, 8).Value
Else
End If
Next i
'add column for ageing
Range("J1").Value = "Ageing"
For i = 2 To LastRow
.Cells(i, 10).Value = UserDate - .Cells(i, 9)
Next i
'add sheet ">90" - deletes previous sheet with name ">90"
Application.DisplayAlerts = False
On Error Resume Next
Sheets(">90").Delete
Application.DisplayAlerts = True
On Error GoTo 0
Sheets.Add.Name = ">90"
Set ws2 = Worksheets(">90")
'copy >90 days
.Range("$A:$J").AutoFilter Field:=10, Criteria1:=">90"
.UsedRange.SpecialCells(xlCellTypeVisible).Copy _
Destination:=ws2.Range("A1")
ws2.Cells.EntireColumn.AutoFit
'delete rows with negative ageing values
.Range("$A:$J").AutoFilter Field:=10, Criteria1:="<0"
.Range("A2:J" & LastRow).SpecialCells(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub