Here’s the VBA code that should be equivalent to the Excel VBA code you provided:
Sub ProcessAPInvoices()
Sheets("Unprocessed AP Invoice Liabilit").Select
If ActiveSheet.AutoFilterMode Then ActiveSheet.AutoFilterMode = False
Dim lr As Long
lr = Cells(Rows.Count, 1).End(xlUp).Row
Range("L2").Select
ActiveCell.FormulaR1C1 = "=RC[-6]-TODAY()"
Range("L3").Select
Columns("L:L").EntireColumn.AutoFit
Range("L2").Select
ActiveCell.FormulaR1C1 = "=TODAY()-RC[-6]"
Selection.NumberFormat = "0"
Range("M2").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-1]<=7,""0-7"",IF(RC[-1]<=14,""8-14"",IF(RC[-1]<=29,""15-29"",IF(RC[-1]>30,"">30"",""NA""))))"
Range("L2:M" & lr).Select
Selection.FillDown
Range("A1").Select
If ActiveSheet.AutoFilterMode Then ActiveSheet.AutoFilterMode = False
End Sub
Note that the code assumes that you have a worksheet named “Unprocessed AP Invoice Liabilit” and that it contains data in columns A through M. If any of these assumptions are incorrect, you may need to modify the code accordingly.
The Developer tab may not be visible in Excel by default. Here’s how you can make it visible:
Click on the File tab in the ribbon menu.
Click on Options.
In the Excel Options window, click on Customize Ribbon.
In the right pane, under Customize the Ribbon, select the Developer check box.