Hey there stranger!

Sign up to get access.

How to Edit a Macro

About this Tutorial

Editing macros in Google Sheets helps you do more in less time.

Video Transcript

 Hi, welcome back. In this video I'm gonna show you how to edit macros. I'm gonna show you how to first manage them. All I did since the last video was make a copy of the sheet. So there's a couple things that are gonna happen. One we are going to have to go through a few of the processes we went through last video because it's a brand new sheet.

And when it's a new sheet and you're dealing with macros, you have to let it authorize. As we did in the last video, Our tools, macros. We have these right now. A couple things to know when you're editing or managing them or wanna do things, if you click manage, all you can do is rename them. So insert row left, and you can set the shortcut key.

You can use number or anything like that. You can't use a letter, so insert. Column, right? Oh, this is insert call left. So we can update those we can go to macros. We can here, we can record them, can manage them, or we can use them. And when we try to use one, and again, this is a brand new sheet, so it's gonna go through the very first thing we have to deal with from the last sheet we did this.

So it's gonna look like this. Authorization required continue.

It's gonna be our Google name, so we're gonna choose our account. We're gonna let it authorize again. This is something we did in the last one, and we're only doing this again because it's a brand new sheet with the same. Okay, so our macros ran. You can see that cuz this column here was nine. Now it's 10.

If we do it again, command option shift two. It's running. See, it adds a column. Okay. So our macros are now running in this new one. We didn't have to rerecord them because we just literally copied the whole sheet. You can more than, you're more than welcome to try to rerecord them. But how to edit them, you have to go to the script editor, and this is what it looks like.

It's gonna load up sometimes pretty slow depending on your depending on your speed. This is what we looked at, the very first video when you did, how to edit how to write a script. But now we have way more complicated scripts here and they're recorded for us with the macros. And we can actually edit these.

In this case it says function insert road to the left. And I'm gonna try to read this with you. So the variable spreadsheet is equal to spreadsheet dot get active, which means what is the spreadsheet we're on right now? Active means we're actively on it. We're working in it. Get range, activate it to mean that's the one we wanna work with.

Then get the spreadsheet again. So each time it does something, it has to go to the right spreadsheet and it says insert column. Before that column that we're on. Okay, so this is just the same thing again. We need to say, okay, we're in the spreadsheet, we're in the range, we're in the exact column.

Okay, now insert a column before that. Okay. And then we just say, offset. Now activate. So like we're not, we're basically moving our, where we are, where our cursor is. We're not moving that because we're inserting a column. We're moving to the right. In this case, the. And then we're moving back. So our cursor doesn't really move anywhere.

And that's what that this is all doing. So to edit this, so basically what we might want to do is we might want to run this say every day. So we might want to write a trigger, which we'll do in the next video. And if we do, we want, or we want to run it from, say another sheet. So let's say we have a sheet and we call it daily.

And we have this sheet, we say summary. What if we were on here and we're like, oh crap. I want to add another column here. This macro doesn't say anything about what sheet it's on, so we're gonna add that. So we're gonna say get spreadsheet sheet. Actually it's gonna be sheet

by name. And then we're gonna do in quotes daily. So when we run this insert row on daily, I'm gonna rename that we're gonna actually delete all this so it's a little less confusing. So all we're doing is we are going to the daily sheet and we're gonna add at c C column, add a column before that.

Okay. So we have to command save to save it. Anytime we make a change, this red thing tells us we made a change. We have to save it. Okay, and now we're gonna run into some problems. I'm gonna show those problems to you and work through them. Let's see what happens. So we're on daily. We do, let's go back to our tools, macro.

Now we're gonna go to tools, macros, import, and we're gonna add this function insert row on daily function added.

So now we can manage our macros. We can give that one, so that's our shortcut. We can also go to tools, macros, and just run it, see if it runs and it doesn't run because it has a, it has an error. What is this error? It says spreadsheet dot get active sheet is not a function. So let me tell you what that means.

So first of all, dismiss it and then we'll go back here and we'll fi fix this. So we should have to just delete this, get active sheet because we're getting the sheet by name. We don't need to get the sheet again. So let's do, try that one more. Let's do running the script and then ran the script. So all we had to do was we got the sheet by the name so we didn't have to get the active sheet.

That's all that is what the only change I made there. And now we do that. Now let's go to summary and do it again. So it's command option shift one, it's running the script, and TA now goes back. What if we, let's see. Let's do something visual to see that it's adding. If we try that again, it'll add, boom.

See those are all moving over and now we have a new row there. Okay. And we can also, let's see if we can delete this, what that does, so if I'm on the summary tab, Command option shift one. It's running the script and it all, it brings it back here. Cool. So I just did this. All I did was delete this activate because that activate is gonna bring us over there.

So all I did was delete that command save. And now this is gonna happen in the background. So we have seven columns here. Let's go here. Copy that and go to summary, and it's oh no, we need to add a row or column, command option shift one. It's running the script. It finished the script. Did it do it?

Yes, it did. It added. Added a column. All right, so we are now editing our macros. Now you can use a macro record, a macro, anytime you wanna learn how something works in a script, record a macro and then go read it and see how that works. Edit it. And you're gonna run into some errors. You're gonna run into some problems, but you can fix those now that I walked you through it.

In the next video, we're going to do this every single day so we don't have to do it. Bye.

Courses

Sheet Stories / Video Notes + ADDED: Email Notifications

00:00:00

ChatGPT Clone in Google Sheets Part 2

Fast FAQS

Why Different Cell References in AI Integration in Sheets?

Show Sheet Tabs Based on Edit

Add Title Case to Google Sheets

How to Power Testimonials with Google Forms and Sheets

Getting Started Coding in Apps Script

Seek Errors When Coding Apps Script

Think Like a Programmer: Develop The Mindset of an Apps Script Coder

ChatGPT Clone in Google Sheets Part 1

Embed a Number in a Website from a Google Sheet

Create Navigation Like A Book or Presentation

Add Click Tracking To Your Google Sheets | Bitly in a Google Sheet

00:29:08

Hold a Giveaway Raffle in a Google Sheet

Embed a Headline in a Website from Google Sheets

Capture Emails from Website Form to a Google Sheet (Without Zapier)

Quickstart Tutorial OpenAI API in Google Sheets

Create a new Spreadsheet from just a Name in a Sheet.

00:05:21

Bjarne Asks: Can I show the Last Time of the Last Edit in a sheet?

00:05:43

Email Yourself a Cell from a Google Sheet, Every Day

OpenSea Data Inside Sheets

Create an Email Campaign Stats Calculator

00:35:13

Twitter App Clone in a Google Sheet

Dylan Asks: How to Automatically Delete Rows If Cell Contains Value

Highlight Row as You Move Your Cell Selection

Create a Timer with Apps Script

LinkTree in a Google Sheet

00:11:22

Password Protecting Data In a Google Sheet

Automatic Weekly Backup of Google Sheets

Create a CPM Custom Function (Create Better Calculators!)

Move Entire Row when a Cell is changed to "Yes" - The $75,000 Google Script

00:12:29

What Can You Automate in Google Sheets? Every single trigger available to Google Sheet users

Sync Two Tabs Without ImportRange()

Google Sheets Stories? No! But we'll add timestamped video notes to your google sheets.

00:00:00

Password Protecting Data In a Google Sheet Part 2 The Basics

Benoit Asks: How to Convert Case

00:07:35

Learn to Code in Google Sheets, For Programmers

Add a Checkbox to Turn on Dark Mode

00:05:10

Write Your First Script

00:08:31

Find Keywords in Any Column. Create quick search dropdown to find keywords

00:09:37

Basic CRM - Add a Powerful Script To Move Row Based on Status

How To Improve: 1,000 Business ideas: Business Idea Generator

00:11:20

Let's Make a Bookmarklet!

00:12:37

Troubleshooting Bitly in a Google Sheet Script

00:07:07

Unique Features - Design a Better Dashboard Part 2

00:04:13

How To Set Up Stripe Webhook to Google Sheets with Google Script

00:22:10

How to Edit a Macro

00:08:22

Sheet Stories / Video Notes + Clear 24 Hour Old Videos

00:35:10

Add A Timestamp to Task Lists (without Now Formula)

00:07:44

Make your Custom Functions Like Native Functions | Custom Function Autocomplete

00:17:58

Create a Changelog Between 2 Cells Custom Function | To learn Double For Loop

00:23:26

New Syntax for WhatChanged Formula in Google Script

00:07:14

How to Record Macros

00:06:20

2 Ways to Delete Lines Quickly (CAREFUL, it's a script!)

00:09:53

Deep Inside Dark Habits Google Script

00:18:54

How to Trigger Macros Daily

00:06:58

5 Ways to Create Coupon Codes | Create UUIDs

Create a Radio Button From Checkboxes Using Google Apps Script

00:15:01