Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

196
Vistas
How can I make a macro dynamic in google sheets?

I've been trying to create a dynamic macro that copies the previous row and pastes it in the actual one. I've been able to create it, and it runs each time that I change the sheet (on change trigger). Until then, everything is fine.

The thing is that I'm only able to do it for a specific row, i.e., I've created it for row 11, however, once that it has run in row 11, I want it to work for row 12, once that row 12 is fulfilled, then it goes to row 13, and so on.

This is what I have now:

function copyandnumber() {
  var spreadsheet = SpreadsheetApp.getActive();
  spreadsheet.getRange('L11').offset(-1, 0, 1, 25).copyTo(spreadsheet.getRange('L11'), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
};

Do you know how to change this 11 by something dynamic, for it to work on every row?

Thank you very much!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try

function copyandnumber() {
  var spreadsheet = SpreadsheetApp.getActive();
  var lastRow = spreadsheet.getLastRow();
  spreadsheet.getRange('L'+lastRow).offset(-1, 0, 1, 25).copyTo(spreadsheet.getRange('L'+lastRow), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false);
};
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda