Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

229
Views
¿Cómo puedo cambiar manualmente el contenido de una celda cuando tengo un script para configurar automáticamente esa celda?

He creado el siguiente script:

 function onEdit() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sh = ss.getSheetByName("Sheet1"); var cell = sh.getRange("A1:A1"); var cells = sh.getRange("B1:B1"); if( cell.getValue() !="" ) { cells.setValue(new Date()); } if( cell.getValue()==="" ) { cells.clearContent(); } }

Este código puede insertar una nueva fecha en la celda B1 cuando se ingresan datos en la celda A1. También puede eliminar la fecha de la celda B1 cuando borro los datos de la celda A1. Pero si quiero cambiar manualmente la fecha en la celda B1 cuando la celda A1 tiene datos ingresados, ¿cómo puedo hacerlo?

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Prueba esta función

 function onEdit(e) {let cellDate=e.source.getActiveSheet().getRange('B1'); if(e.range.getA1Notation()=='A1'&&e.source.getSheetName()=='Sheet1') {if(e.value==null) cellDate.clearContent(); else cellDate.setValue(new Date());} }

Nota: Esta función verifica si la celda cambiada es A1, luego realiza el cambio a B1. Entonces puede cambiar completamente B1 después de haber cambiado A1

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!