Still relying on a VBA macro that only runs on Excel desktop? If your team has moved into Excel for the web, Teams, or Power Automate, those old subroutines stop working the moment they leave the desktop app. This tutorial walks through migrating a real FormatSalesReport macro into an Office Script using sales data in A1 to D6. By the end, you'll know how to rewrite a VBA macro line by line into ExcelScript so it runs everywhere Microsoft 365 lives.
Covered inside:
→ Reviewing the legacy FormatSalesReport subroutine inside the Visual Basic Editor
→ Opening the Automate tab and clearing the default function main template
→ Pasting the equivalent Office Script that bolds the header, fills it with 4472C4, and autofits columns A through D
→ Mapping ActiveSheet, Interior.Color, AutoFit, and Formula calls to their getRange and getFormat equivalents
→ Renaming the script to FormatSalesReport and saving it from the disk icon
→ Running the script and confirming the blue header, white bold text, and Total column populate correctly
Which mapping tripped you up first, the Interior.Color hex swap or the AutoFit chain? Drop your migration story below.
#ExcelVBA #OfficeScripts #Microsoft365 #ExcelAutomation #VBAMigration #ExcelForTheWeb #PowerAutomate #ExcelTutorial #ExcelScripting #SalesReport #Excel2026 #MacroMigration