XXLFormula AI
Pro ProjectFinanceIntermediateIncludes .xlsm

Budget Automation

4.9· 4,820 learners

A production-ready VBA project that turns a raw transactions sheet into a live monthly budget. Includes category matching, savings-goal recalculation, an auto-refreshed trend chart, and structured error handling. Ideal as a starting point for finance teams that need repeatable month-end reporting.

Learners
4,820
Duration
3 hours
Difficulty
Intermediate
Budget Automation.xlsm — VBA EditorFileEditViewInsertFormatDebugRunToolsAdd-InsWindowHelpRun Sub/UserForm (F5)Project — VBAProjectVBAProject (Budget Automation.xlsm)Microsoft Excel ObjectsSheet1 (Transactions)Sheet2 (Dashboard)Sheet3 (Settings)ThisWorkbookFormsfrmCategoryEditorModulesmodBudgetmodChartsmodUtilsClass ModulesclsTransactionProperties — modBudget(Name)modBudget(General) ▾    RefreshBudget ▾1Option Explicit23' Budget refresh — one-click month-end.4Public Sub RefreshBudget()5    Dim wsData As WorksheetwsDash As Worksheet6    Dim lastRow As Longi As Long78    On Error GoTo Fail9    Application.ScreenUpdating = False1011    Set wsData = ThisWorkbook.Worksheets("Transactions")12    Set wsDash = ThisWorkbook.Worksheets("Dashboard")13    lastRow = wsData.Cells(wsData.Rows.Count"A").End(xlUp).Row1415    For i = 2 To lastRow16        Call AddToCategory(wsDash_17            CStr(wsData.Cells(i"C").Value), _18            CCur(wsData.Cells(i"D").Value))19    Next i2021    Application.ScreenUpdating = True22    MsgBox "Budget refreshed."vbInformation23    Exit Sub24Fail:25    Application.ScreenUpdating = True26    MsgBox "Failed: " & Err.DescriptionvbCritical27End SubImmediate — runningRefreshBudget?RefreshBudget › Loaded 218 transactions from 'Transactions' › Categories matched: 12 / 12 › Savings goals recalculated (6 goals) › Trend chart rebuilt in 42 ms Done. 0 errors, 0 warnings.ReadyLn 24, Col 5

Project screenshots

Code preview

Syntax-highlighted VBA — first 14 lines unlocked. Upgrade to view the full project.

budget-automation.bas
VBA
1Option Explicit
2 
3' Budget Automation — categorise transactions and refresh the dashboard.
4' Attach this Sub to a button on the "Dashboard" sheet.
5 
6Public Sub RefreshBudget()
7 Dim wsData As Worksheet, wsDash As Worksheet
8 Dim lastRow As Long, i As Long
9 Dim category As String, amount As Currency
10 
11 On Error GoTo Fail
12 Application.ScreenUpdating = False
13 
14 Set wsData = ThisWorkbook.Worksheets("Transactions")
15 Set wsDash = ThisWorkbook.Worksheets("Dashboard")
16 
17 lastRow = wsData.Cells(wsData.Rows.Count, "A").End(xlUp).Row
18 
19 ' Reset totals block
20 wsDash.Range("B4:B20").ClearContents
21 
22 For i = 2 To lastRow
23 category = CStr(wsData.Cells(i, "C").Value)
24 amount = CCur(wsData.Cells(i, "D").Value)
25 Call AddToCategory(wsDash, category, amount)
26 Next i
27 
28 Call RecalculateSavingsGoals(wsDash)
29 Call UpdateTrendChart(wsDash)
30 
31 Application.ScreenUpdating = True
32 MsgBox "Budget refreshed successfully.", vbInformation
33 Exit Sub
34Fail:
35 Application.ScreenUpdating = True
36 MsgBox "Refresh failed: " & Err.Description, vbCritical
37End Sub
38 
39Private Sub AddToCategory(ws As Worksheet, category As String, amount As Currency)
40 Dim r As Range
41 Set r = ws.Range("A4:A20").Find(What:=category, LookAt:=xlWhole)
42 If Not r Is Nothing Then
43 r.Offset(0, 1).Value = r.Offset(0, 1).Value + amount
44 End If
45End Sub
Locked preview

Unlock XLFormula AI Pro to view the complete project source, download the .xlsm workbook, and generate custom VBA with AI.

Unlock with Pro

Key features

  • One-click refresh from raw transactions
  • Category matcher with fuzzy fallback
  • Auto-updating savings-goal progress bars
  • Trend chart regenerated on refresh
  • Structured error handler with clean UI restore

What's included

  • Budget Automation.xlsm workbook
  • Signed VBA project (safe to enable)
  • Setup guide (PDF)
  • Sample month prefilled with 200 transactions
Included with Pro

Get this project — and every other one

Every download, every VBA project, every future release for $5.00/month.

  • AI VBA Generator
  • Download Projects
  • Complete VBA Library
  • Lifetime Updates
  • Premium Templates
  • Priority Support

Frequently asked questions

Does it work on Excel for Mac?
The core macros work on Excel 2019+ for Mac. Path separators are handled automatically.
Can I add my own categories?
Yes — categories live on the Settings tab and are picked up automatically on the next refresh.

Related projects