Automatic sorting by column names "C" - Google Sheets

Solved
alinco Posted messages 66 Status Member -  
David_3412 Posted messages 1 Status Member -
Hello,

I want to set up an automatic sorting in my Google Sheets.
Let me explain: when I enter a name in column "C," it should automatically sort in alphabetical order within that column while bringing the row through to column "O."

If someone could give me the steps to follow...

P.S. I can sort the range, but that’s not what I’m looking for. And then I have to do it each time… :-(

Thank you in advance.

Configuration: Windows / Firefox 65.0

6 answers

  1. JCB40 Posted messages 3058 Registration date   Status Member Last intervention   479
     
    Hello
    Open the sheet of your spreadsheet
    click on tools
    click on script editors
    copy the code below and paste it into the script sheet

    function Macro sort() {
    var spreadsheet = SpreadsheetApp.getActive();
    spreadsheet.getRange('C1:O65000').activate();
    spreadsheet.getActiveSheet().sort(3, true);
    };

    save the file
    After each addition of names in column C >> tools >> macros >> sort macros
    Best regards
    2
    1. alinco Posted messages 66 Status Member
       
      Hello JCB40,

      Thank you for looking into my case :-)

      When I try to save the code, I get the following error:



      I forgot to mention that the sorting should be done from C4 downward, more precisely from "C4:O95"

      Thank you for letting me know how to proceed...
      0