Members-only tutorial

Watch the video and get the practice sheet with membership.

Unlock tutorials

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

<div>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?<br>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.<br>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.<br>0:36 You really are just like doing a visual check of this data . Everything I know about Checkboxes (Cool Hacks) How To Hide Data with Checkboxes in Google Sheets Checkbox or Dropdown?

You're looking at it, and then you're moving to the next row on down or up, or however you wanna do it.<br>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?<br>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.<br>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.<br>1:12 So you actually don't use this function at all. Can ChatGPT Automate Spreadsheets? 2 Ways to Delete Lines Quickly (CAREFUL, it's a script!) Alternate Row Color Automatically

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.<br>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.<br>1:35 This on selection change is a built in Google app script function that will do what it says on selection change.<br>1:44 It will execute this. No More Google Sheet Tricks 2 Ways to Delete Lines Quickly (CAREFUL, it's a script!) How to Stop onEdit Automation in Google Sheets

And what is it executing?&nbsp; The only thing that it's executing is it's setting the background color to this red.<br>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 .<br>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.<br>2:12 Actually it's over to cv. 80 Years In 1 Spreadsheet Count Color by Row

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.<br>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.<br>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.<br>2:51 So as you can see, it's skipping some if I very rapidly do it. How to Highlight Top 3 Numbers in Column

So that's one of the drawbacks of this.<br>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.<br>3:07 So let me go back and I will, all I have to do is add two back slashes, command s and save.<br>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?<br>3:22 Well, this on selection change. First off, it's a built in function , as I mentioned earlier. No More Google Sheet Tricks MESSIEST SPREADSHEET MISTAKE

We just write function on selection change with these parentheses.<br>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.<br>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 .<br>3:54 So what the range is, is whatever is highlighted in the cursor area. So it's blue area. Getting Started Coding in Apps Script Automation is not Magic

So if the range is this, it's all four of those.<br>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.<br>4:31 So we're getting the entire row from the first column to the very last column here. Absolute Basics of Google Sheets What is a Spreadsheet? Anatomy of a Spreadsheet

And we are changing, we are gonna set the background RGB to this color.<br>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.<br>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.<br>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.<br>5:29 Okay. So we probably don't want that. 80 Years In 1 Spreadsheet Start Sheeting Better in 2026

Probably want something like 250 and 50, See what that is? Okay, that's a bit more red.<br>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.<br>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.<br>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.<br>6:22 This is not the fastest script. This on selection change is pretty slow. 150 VCs Actively Investing by Lemon.io

But again, just for saving us a few clicks, this is pretty darn cool.<br>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.<br>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 .<br>7:01 I use a lot of oned in some videos. Absolute Basics of Google Sheets MESSIEST SPREADSHEET MISTAKE

And so I thought this would be a cool way to show this on selection change and a pretty cool thing.<br>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.<br>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.<br>7:29 Copy and paste that into where are we, We are in extensions app script . So copy paste that into here. Learn to Code in Google Sheets, For Programmers | For Advanced Google Sheet Users Advanced Coding in Google Sheets for Programmers VIBE CODE GOOGLE SHEETS

Save, make sure to command S and save.<br>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.<br>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.<br>8:02 Hopefully you can highlight your rows as you move yourself. Selection by.</div> Alternate Row Color Automatically

Courses

Sheet Stories / Video Notes + ADDED: Email Notifications

00:00:00

ChatGPT Clone in Google Sheets Part 2

Enter Google Drive File Name Get URL

Fast FAQS

Create an Internal Google Sheets Add-on

Tweet From a Sheet

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

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.

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

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

00:11:20

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

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

5 Ways to Create Coupon Codes | Create UUIDs

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

Create a Radio Button From Checkboxes Using Google Apps Script

00:15:01