VBA & Apps Script generator
Automate the boring parts with a macro
Describe the task in plain English. Choose Excel for a VBA macro or Google Sheets for an Apps Script, and get commented code plus exact install steps.
- VBA for Excel
- Apps Script for Sheets
- Install steps included
Your recent formulas
Saved in this browser only.
Excel
Install a VBA macro
- Press Alt + F11 (Mac: Option + F11) to open the VBA editor.
- Choose Insert > Module and paste the code.
- Close the editor and press Alt + F8, pick the macro and click Run.
- Save the file as .xlsm to keep the macro.
Google Sheets
Install an Apps Script
- Open Extensions > Apps Script.
- Replace the sample code with the generated script and click Save.
- Pick the function at the top and click Run. Approve access the first time.
- Scripts named
onEditrun by themselves whenever you edit the sheet.
More free spreadsheet tools
Everything you need when a formula gets in the way.
- Formula generatorDescribe it in plain English, get a working formula.Open tool
- Formula explainerPaste any formula and see what each part does.Open tool
- Formula fixerFix #N/A, #VALUE!, #REF! and wrong results.Open tool
- Excel ↔ Sheets converterTranslate formulas between Excel and Google Sheets.Open tool
- Clean my dataTrim, dedupe and tidy a table, privately in your browser.Open tool
- Regex formulasExtract, match and replace text with REGEX functions.Open tool
- Conditional formattingCustom-formula rules to highlight cells and rows.Open tool
Frequently asked questions
What is the difference between VBA and Apps Script?
VBA is the macro language built into desktop Excel for Windows and Mac. Google Sheets uses Apps Script, which is JavaScript that runs in Google's cloud. Choose Excel to get VBA or Google Sheets to get Apps Script.
Do VBA macros work in Excel for the web?
No. VBA only runs in desktop Excel. Excel for the web uses Office Scripts instead. If you work in the browser, Google Sheets with Apps Script is the closest alternative.
Is it safe to run a macro I did not write?
Read through the code first and always run it on a copy of your file. The generated macros include comments so you can see what each part does. Macros that delete rows cannot be undone with Ctrl+Z.
How do I save a workbook with a macro?
Save it as an Excel Macro-Enabled Workbook (.xlsm). A normal .xlsx file removes all macros when you save.