The task is to paint over the cell in which the changes occurred.

In normal Excel, everything works with VBA code:

Option Explicit Dim vValue Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count > 1 Then Exit Sub If Target <> vValue Then Target.Interior.Color = vbRed End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Count = 1 Then vValue = Target End Sub 

I tried to transfer the table to google like this (which is not right!):

 function Option (Explicit){ var vValue; Private Sub Worksheet_Change(ByVal Target As Range); if(Target.Count > 1 ){ Exit Sub; } if(Target != vValue ){ Target.Interior.Color = Red; } } Private Sub Worksheet_SelectionChange(ByVal Target As Range); if(Target.Count == 1 ){ vValue = Target; } } 

Tell me, please, how to fix it? Is it possible to integrate the usual excel capabilities into google tables?

  1. Link to google test table https://docs.google.com/spreadsheets/d/1HJKrhe-N6MzP0Kq-2faAK_tTAYC2khWdxrneV2gaQp4/edit?usp=sharing

  2. Excel's working version is https://drive.google.com/file/d/1yT50byq78rT-9BbdzuCQ3eoQSwWPgF6C/view?usp=sharing

  • VBA is one programming language, and Google Apps Script is completely different. Here you can read about triggers and about Spreadsheet service - Sergey Pryanichkin

1 answer 1

The answer is found (also added a note with the date of the change)

 function onEdit(e){ var range = e.range; // Π”ΠΎΠ±Π°Π²ΠΈΠΌ ΠΏΡ€ΠΈΠΌΠ΅Ρ‡Π°Π½ΠΈΠ΅ range.setNote('Π”Π°Ρ‚Π° измСнСния: ' +(Utilities.formatDate(new Date(), "GMT", "dd.MM.yyyy"))); //Закрасим ячСйку range.setBackground("red"); }