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.
Syntax-highlighted VBA — first 14 lines unlocked. Upgrade to view the full project.
1Option Explicit23' Budget Automation — categorise transactions and refresh the dashboard.4' Attach this Sub to a button on the "Dashboard" sheet.56Public Sub RefreshBudget()7 Dim wsData As Worksheet, wsDash As Worksheet8 Dim lastRow As Long, i As Long9 Dim category As String, amount As Currency1011 On Error GoTo Fail12 Application.ScreenUpdating = False1314 Set wsData = ThisWorkbook.Worksheets("Transactions")15 Set wsDash = ThisWorkbook.Worksheets("Dashboard")1617 lastRow = wsData.Cells(wsData.Rows.Count, "A").End(xlUp).Row1819 ' Reset totals block20 wsDash.Range("B4:B20").ClearContents2122 For i = 2 To lastRow23 category = CStr(wsData.Cells(i, "C").Value)24 amount = CCur(wsData.Cells(i, "D").Value)25 Call AddToCategory(wsDash, category, amount)26 Next i2728 Call RecalculateSavingsGoals(wsDash)29 Call UpdateTrendChart(wsDash)3031 Application.ScreenUpdating = True32 MsgBox "Budget refreshed successfully.", vbInformation33 Exit Sub34Fail:35 Application.ScreenUpdating = True36 MsgBox "Refresh failed: " & Err.Description, vbCritical37End Sub3839Private Sub AddToCategory(ws As Worksheet, category As String, amount As Currency)40 Dim r As Range41 Set r = ws.Range("A4:A20").Find(What:=category, LookAt:=xlWhole)42 If Not r Is Nothing Then43 r.Offset(0, 1).Value = r.Offset(0, 1).Value + amount44 End If45End Sub
Unlock XLFormula AI Pro to view the complete project source, download the .xlsm workbook, and generate custom VBA with AI.
Unlock with ProEvery download, every VBA project, every future release for $5.00/month.
Refresh every PivotTable and chart, then export a snapshot PNG for the daily report.
Generate a PDF invoice from a template, email it via Outlook, and log every invoice to a register.
Daily check-in macro with per-employee monthly summaries and automatic PTO deduction.