Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9782

Macro to return 1 + the value of the cell above

$
0
0

I am experienced with VBA but not Google Apps Script / Javascript.

I'm doing a lot of data entry for which filling down with CTRL+D is super-useful but I want to create a macro that will copy down the value from the row above while also adding 1.

I've had a few attempts and I can't get it to work.

So far, I have only successfully achieved it by the rather obtuse two-step method of copying down with CTRL+D followed by this code to increment the value:

  var c = SpreadsheetApp.getActive().getCurrentCell();  c.setValue(c.getValue()+1);

How do I get the value of the cell above and add 1 to it in a single step?


Viewing all articles
Browse latest Browse all 9782

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>