Skip to content

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

Try an example:

Spreadsheet app
Argument separator

Free: 25 requests a day, no sign-up

Excel

Install a VBA macro

  1. Press Alt + F11 (Mac: Option + F11) to open the VBA editor.
  2. Choose Insert > Module and paste the code.
  3. Close the editor and press Alt + F8, pick the macro and click Run.
  4. Save the file as .xlsm to keep the macro.

Google Sheets

Install an Apps Script

  1. Open Extensions > Apps Script.
  2. Replace the sample code with the generated script and click Save.
  3. Pick the function at the top and click Run. Approve access the first time.
  4. Scripts named onEdit run by themselves whenever you edit the sheet.

More free spreadsheet tools

Everything you need when a formula gets in the way.

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.