Google-sheets – Macro to move down and separate data

google sheetsgoogle-apps-scriptgoogle-sheets-macro

I wish to use a macro in Google Sheets to

  1. find the number 1 in column A
  2. then move that corresponding row and all following rows down to start at A9 row
  3. then find the number 2 in column A
  4. then move that corresponding row and all following rows down to start at A25
  5. then find the number 3 in column A
  6. then move that corresponding row and all following rows down to start at A41 and so on down to number 24.

Each number 1,2,3,… has a varying number of data rows below it before the next number and so I can't simply do one "paste" at A9 with all of the information being in the correct place.

I have tried recording a macro using FIND menu item but it does not work.

Best Answer

In Google Sheets the Find command highlights the cells that match the searched value. To jump (activate) a matching cell, instead use Find and Replace. Bear in mind that the macro recorder will not record any action for Find and for Find and Replace will only record the cell activation.

I suggest you that instead of the Google Sheets macro recorder write your script directly on the script editor. Once you did this, you could "Import" the script as a macro to be called from the Macros menu and / or a custom keyboard shortcut.