Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your question is really multiple questions in one, and I will only deal with the second part, the first part has quite a number of dimensions (how to update summary sheets effectively), which we can discuss with another question maybe.</p> <p>In order to determine if the data in a particular sheet needs to be copied, you could create a simple function that returns a boolean if the sheet satisfies the condition that it is a number between 1 and 31.</p> <pre><code>function mustBeCopied(sheetName) { var sheetNumber = parseInt(sheetName); if (sheetNumber &lt;=31 &amp;&amp; sheetNumber &gt;=1) return true; return false; } </code></pre> <p>Bear in mind that a sheet with the name "28.7" would satisfy the condition.</p> <p>The first line of your onEdit() script would then look like this</p> <pre><code>if(mustBeCopied(s.getName()) &amp;&amp; r.getColumn() == 7 &amp;&amp; r.getValue() == "RECEBER") </code></pre> <p>Let me know if this works for you.</p> <p>--- Oct 14 ---</p> <p>As far as I can see, the issue that remains, is that when your function was running onEdit, the range (active range) was the cell that was just edited. So the range would be only one cell.</p> <p>In order for the scrip to run, you would need to highlight each cell to be copied before selecting the menu, which would be tedious to say the least</p> <p>Further if you have a defined range to be copied, which is the same on each page, we can copy that range every time, or iterate through each row in the column to look for "RECEBER" and get those rows copied.</p> <p>Further We can try to update your function so that iterate through all the sheets is a many similar to this.</p> <pre><code>var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets(); for (var i = 0; i &lt; sheets.length; i::) { var s = sheets[i]; if (mustBeCopied(s.getName()) { var range = s.getRange(someRow, 7, someNumOfRows); for (var j = 1; j &lt;= someNumOfRows; j++) { if (range.getCell(j,1).getValue() == "RECEBER") { //YOUR COPY CODE } } } } </code></pre> <p>Let me know how this works.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload