Hey there stranger!

Sign up to get access.

Highlight Row as You Move Your Cell Selection

About this Tutorial

Checking data? This script changes bg color of entire row as you move your cell selection.

Video Transcript

0:00 Hey, so let's consider if we are checking data by hand, you know, in the god forbid situation where we have to look at a lot of rows of data and we have to manually check, right?
0:18 Some simple ways to do this might be to insert a checkbox here and say, Okay, I've checked off these. You might wanna do this over many different sessions.
0:26 You might wanna do this over many different hours, and you might be already, you know, say have some kind of check here.
0:36 You really are just like doing a visual check of this data. You're looking at it, and then you're moving to the next row on down or up, or however you wanna do it.
0:46 Wouldn't it be better if as you just move the cursor, it automatically highlights that row as you move? That would be pretty cool, right?
0:56 So it created this little function here in app script that you can use. Now you can copy and paste this into your sheet if you wish.
1:03 All you have to do is undo this two slashes, which are essentially comments. This function is gonna be running all the time.
1:12 So you actually don't use this function at all. If you don't want to use it, you can just delete it and copy and paste it in, or just delete this part and then add it back in if you don't wanna do it.
1:25 All right? So I'm gonna undo those two or delete those two. Save this. Now, I didn't do anything. I didn't authorize any scripts or anything.
1:35 This on selection change is a built in Google app script function that will do what it says on selection change.
1:44 It will execute this. And what is it executing?  The only thing that it's executing is it's setting the background color to this red.
1:52 And I'll show you what happens here. So if we're on this line four, and all I'm doing is moving the cursor down one time it highlights the entire row.
2:03 If I move it down again, it's highlighting the entire row that I'm on. If we go over to the right, we can see it's the entire sheet.
2:12 Actually it's over to cv. So it's not the data that it's it's not getting the last column of the data, it's getting the last column of the entire sheet.
2:20 So, oh, we checked the top three so I can go up and also highlight those and keep going, right? And this now will highlight as I move, I have to do it pretty slowly.
2:39 So I am, it's useful when you are actually physically checking something and it takes a few moments. If I just rapidly hit down, it does not actually do everything.
2:51 So as you can see, it's skipping some if I very rapidly do it. So that's one of the drawbacks of this.
2:57 So you do have to go pretty slowly, but again, this is great for highlighting as you're moving, as you're double checking some data, maybe, maybe capitalization or something.
3:07 So let me go back and I will, all I have to do is add two back slashes, command s and save.
3:13 That orange button goes away. And now as I move around, nothing is happening. So this is not happening. So what is actually going on here?
3:22 Well, this on selection change. First off, it's a built in function, as I mentioned earlier. We just write function on selection change with these parentheses.
3:31 And every time the cursor changes its selection, it will execute this script. What, what is the script? First, we're just getting the sheet, the active sheet that we're on, the actual sheet that we're on right now.
3:45 We're getting max columns, which is just counting how many columns there are in this active sheet spreadsheet. We're getting the range.
3:54 So what the range is, is whatever is highlighted in the cursor area. So it's blue area. So if the range is this, it's all four of those.
4:03 If it's one cell, it's on one cell. We're getting that active range, and we're saying, okay, in that active range, well, sorry, in that sheet, Get the range that is starts with one, the row that we're on in this active range, on the first column, one row and column count means we're getting the entire count of all of the columns.
4:31 So we're getting the entire row from the first column to the very last column here. And we are changing, we are gonna set the background RGB to this color.
4:44 So let me save this, undo this commenting out. And this 2 24 1 0 2 1 0 2 is just a red color. If I change it to 0, 0 0, and let's say like 100, 100, we're gonna save that and we're gonna see what happens there.
5:03 We get this sort of a darkish blue, darkish green, okay, if we set these maybe to 50, closer to white, I think.
5:16 Okay, closer to black actually. So if we, we have 0, 0, 0, I bet that's gonna be black. There we go. Full black.
5:29 Okay. So we probably don't want that. Probably want something like 250 and 50, See what that is? Okay, that's a bit more red.
5:45 So if we want like neon orange RGB color value, so we can search for that And see 2 55 95 31. Let's see what that looks like.
5:59 So that's 2 55, 95 31. Now we can just be playing around with the kinds of RGB colors. RGB mean, this is red screen, this is blue, this is 31.
6:14 Let's see what that neon orange is. Yep, that's pretty neat. That's pretty orange. Again, I'm not, I can't go very fast.
6:22 This is not the fastest script. This on selection change is pretty slow. But again, just for saving us a few clicks, this is pretty darn cool.
6:34 Knowing that the selection changes that we're gonna go to is where the row is and what it's gonna highlight. So if we ever miss one, we can probably just go back and fill it in again and know that we did that.
6:50 I think this is pretty cool because this on selection change is a pretty underused, I, it's actually one of the least used in function simple functions.
7:01 I use a lot of oned in some videos. And so I thought this would be a cool way to show this on selection change and a pretty cool thing.
7:10 Just in case anyone wants to, you know, check some data, highlight the data as you go along. You can use this script as is.
7:18 You get a copy of this script down below by just copying the sheet. Again, take this entire function from everything from the word function, all the way to the glass curly bracket.
7:29 Copy and paste that into where are we, We are in extensions app script. So copy paste that into here. Save, make sure to command S and save.
7:40 And also make sure to delete those comment bars, slashes command s, and now it will work. If you add the comments, it will not work.
7:49 It will just do nothing. These bars don't, these variables, these VAs don't do anything. It's only this last this last line of script that actually does anything Cool.
8:02 Hopefully you can highlight your rows as you move yourself. Selection by.


Sheet Stories / Video Notes + ADDED: Email Notifications



ChatGPT Clone in Google Sheets Part 2

Create an Internal Google Sheets Add-on

Why Different Cell References in AI Integration in Sheets?

Show Sheet Tabs Based on Edit

Add Title Case to Google Sheets

Getting Started Coding in Apps Script

How to Power Testimonials with Google Forms and Sheets

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


Hold a Giveaway Raffle in a Google Sheet

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

Embed a Headline in a Website from Google Sheets

Quickstart Tutorial OpenAI API in Google Sheets

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


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


Email Yourself a Cell from a Google Sheet, Every Day

OpenSea Data Inside Sheets

Create an Email Campaign Stats Calculator


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


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


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.


Password Protecting Data In a Google Sheet Part 2 The Basics

Benoit Asks: How to Convert Case


Learn to Code in Google Sheets, For Programmers

Add a Checkbox to Turn on Dark Mode


Write Your First Script


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


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

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


Let's Make a Bookmarklet!


Troubleshooting Bitly in a Google Sheet Script


Unique Features - Design a Better Dashboard Part 2


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


How to Edit a Macro


Sheet Stories / Video Notes + Clear 24 Hour Old Videos


Add A Timestamp to Task Lists (without Now Formula)


Make your Custom Functions Like Native Functions | Custom Function Autocomplete


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


New Syntax for WhatChanged Formula in Google Script


How to Record Macros


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


Deep Inside Dark Habits Google Script


How to Trigger Macros Daily


5 Ways to Create Coupon Codes | Create UUIDs

Create a Radio Button From Checkboxes Using Google Apps Script