Members-only tutorial
Watch the video and get the practice sheet with membership.
About this tutorial
Annotated transcript
37 formulas linked inline Click any highlighted terms to learn more.<div> 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 .<br><br>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. How to Spin Content How to Assign Macros To Buttons in Google Sheets
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.<br><br>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. How To Add Columns in Google Sheets How To Insert Row Under Header Automatically
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.<br><br>So it's gonna look like this. Authorization required continue.<br><br>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. Build A Business: PR Agency in a Google Sheet Automatic Certificate Creation in Google Sheets
Now it's 10.<br><br>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.<br><br>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. Run Every Prompt in Every Cell All At Once How to Assign Macros To Buttons in Google Sheets
But now we have way more complicated scripts here and they're recorded for us with the macros. And we can actually edit these.<br><br>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.<br><br>Then get the spreadsheet again. Getting Started Coding in Apps Script Advanced Coding in Google Sheets for Programmers Automation is not Magic
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.<br><br>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. How To Add Columns in Google Sheets When Urgent, Move to Top of Google Sheet What is a Spreadsheet? Anatomy of a Spreadsheet
So our cursor doesn't really move anywhere.<br><br>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.<br><br>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. How To Create a Stop Watch in Google Sheets Copy Date to Next Cell Automatically Insert Row Daily Automatically
So we're gonna say get spreadsheet sheet. Actually it's gonna be sheet<br><br>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.<br><br>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. 80 Years In 1 Spreadsheet Insert Row Daily Automatically
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 .<br><br>Now we're gonna go to tools, macros, import , and we're gonna add this function insert row on daily function added.<br><br>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. Getting Started Coding in Apps Script Insert Row Daily Automatically
So let me tell you what that means.<br><br>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 .<br><br>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. Getting Started Coding in Apps Script How to Prevent Delete Tab
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.<br><br>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. Run Every Prompt in Every Cell All At Once Add New Task when Task Completed
All I did was delete this activate because that activate is gonna bring us over there.<br><br>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?<br><br>Yes, it did. It added. Added a column. All right, so we are now editing our macros. How To Add Columns in Google Sheets Add Columns Automatically Add New Task when Task Completed
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.<br><br>In the next video, we're going to do this every single day so we don't have to do it. Bye.</div> One Percent Better Every Day How to Assign Macros To Buttons in Google Sheets