Macros
1. Macros
Macros in Google Sheets allow you to automate repetitive tasks. A macro is simply a series of steps that can be applied to a sheet and its contents with a click, saving time and ensuring accuracy. For example, specific formatting can be applied to a data set to highlight results by changing the header row text to bold, alternating colors for the rows, and making the sums of several columns display in red or green text, subject to conditional formatting rules. To create a new macro, open a spreadsheet. The sheet doesn't have to contain data. But the macro is specific to the spreadsheet, so data will have to be entered or copied to it before the macro that is created can be applied. Open the Extensions menu, hover over Macros, and click Record macro. The macro recording panel will open at the bottom of the sheet. Each action will now be saved to the macro for playback later. Before completing an action, choose between absolute and relative references. As you may remember from earlier in this course, absolute references mean that the actions recorded will be applied to the exact same cells every time the macro is run. Relative reference means that the macro actions will be applied to the selected data range when it is run. A macro that is created while a single cell is selected can be run against thousands of cells once it's recorded. When all of the actions have been completed, click Save to finish the recording and save the macro, type a descriptive name for the macro and optionally, give it a keyboard shortcut, or click Cancel to discard the macro. To use the macro, open the Extensions menu, hover over Macros, and select the macro from the list by clicking on its name. If this is the first time the macro has been used, an authorization prompt will appear, asking the user to allow the macro permission to interact with the spreadsheet and the data in it. Since the origin of the macro is clear, it's safe to allow it access. Macros in Google Sheets are created in a programming language specific to Google workspace called Google Apps Script. No knowledge of Google Apps Script is needed to create a macro. But when editing a macro, the code will be visible. If you need to change a macro's behavior, it's often simpler to just record a new macro, rather than attempt to edit the existing macro script. Let's take a look at how easy it is to create a macro now.2. Let's practice!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.