Which tool to choose
A macro is a sequence of actions, recorded or programmed, that you run with a single command. The tool depends on the sheet you use.
- You use Google Sheets: ask the AI for a script in Apps Script. You paste it into the built-in editor (from the Extensions menu), and link it to a button or a time.
- You use Excel: ask the AI for a macro in VBA (Excel's macro language). You paste it into the macro editor and run it from the menu.
- You already have an Excel macro and switched to Google Sheets: the AI translates the VBA into Apps Script. You paste the old macro and ask for the conversion.
In both cases you don't write the code yourself: you describe it in words and the AI produces it. Your job is to paste it in the right place and run it.
How to do it
The path diverges between Google Sheets and Excel: where it changes, I'll flag it.
Describe the repetitive action. What you do by hand every time: coloring rows with a high value, summing columns, cleaning up a table. Be concrete about column names and conditions.
Ask the AI for the macro. State which sheet you use, so it gives you the right language.
The operational syntax:
Write me a macro for Google Sheets in Apps Script. In the active sheet, it must color the background red for all rows where the value of column C (Stock) is below 5. Explain step by step where to paste the code and how to run it from the sheet's menu.Open the editor and paste.
- In Google Sheets: Extensions menu, then Apps Script. The editor opens: paste the code and save.
- In Excel: Developer tab, then Visual Basic; insert a new module and paste the macro. (If you don't see the Developer tab, it has to be enabled in the options: ask the AI how.)
Run and authorize. Launch the macro from the editor's run button. The first time, Google asks for authorization to run the script on your sheet: grant it only if it's code you've understood and trust.
Link a button or a time. To use it conveniently, add a button in the sheet that runs it, or (in Google Sheets) set it to start automatically at a given time.
A concrete example
Sara manages the warehouse on Google Sheets and every morning scans for products below stock by eye. She asks the AI for the macro from the example: color red the rows with stock below five. She opens Extensions, Apps Script, pastes, saves, runs, authorizes. In an instant all the critical rows turn red. She adds a "Check stock" button at the top of the sheet. Now the check that cost her ten minutes of reading line by line is one click. She didn't write a single line of code herself.
When it does NOT work (and how to fix it)
If Google asks for too many authorizations and you get stuck
On the first run a permission request appears that can be alarming. Fix: it's normal, the script needs permission to modify your sheet. Grant it only for code you requested yourself and understood. If a warning mentions an "unverified" app, proceed only if it's your own macro: follow the advanced options to authorize yourself.
If the macro acts on the wrong columns
The AI mis-aligned the columns because your description was ambiguous. Fix: re-describe it indicating the columns by letter or by header name ("the column titled Stock," "column C") and an example of what should happen on a concrete row.
If an error appears when you run it
The editor shows an error message. Fix: copy it all and paste it into the AI writing "I run this macro and it gives this error." Often the sheet or column cited in the code doesn't match the real names of your sheet: align the names.
If the Excel macro won't start because the files block it
Excel disables macros for security in downloaded files. Fix: save the file in the format that supports macros (with the .xlsm extension) and, if Excel blocks them, enable them from the security settings only for files you trust. Never enable macros in files received from strangers.
A tip from someone who actually uses it
Before letting a macro modify an important sheet, make a copy of the sheet and test it there. A macro that colors cells is harmless; one that deletes rows or moves data can ruin hours of work in an instant, and there isn't always an undo. Test it on the copy, verify it does exactly what you wanted, then apply it to the original. The real sheet is not the testing ground.
Frequently asked questions
What exactly is a macro?
It's a series of actions the sheet performs on its own when you launch it. Instead of repeating the same steps by hand every time (selecting, coloring, summing), you program them once and then press a button. The AI writes the programming for you.
Do I need to know how to code to create one?
No. You describe in words what it has to do and the AI writes the code. You paste it in the right place and run it. You'll learn to recognize the parts over time, but to start, knowing how to describe and paste is enough.
Are macros dangerous?
The ones you write yourself, with the AI, for your own purposes, no, if you test them on a copy. The danger is macros in files received from others: they can hide harmful code. That's why Excel blocks them by default. Enable only your own or those from trusted sources.
Is it better to make a macro or use a formula?
It depends. For a calculation that lives in a cell, a formula is enough and simpler. The macro is for when you have to perform actions (coloring, moving, creating sheets, sending) or repeat a sequence across many rows. If you find yourself making the same clicks every day, that's the sign a macro would save you time; if you just need a result in a cell, stick with the formula.