Although I am familiar with VBA I am a total novice to Google Script so I am after a little help writing, implementing und hopefully understanding a script.
Cell B3 of my sheet has a starting date and every column of row 3 thereafter has a date based on a formula incrementing the date in the cell to its left + 1.
I need to set it up so that when any of my 3 shared users it the active cell is the one with today's date. I found a script that is meant to do this for a column and tried to change it to look up a row instead of a column but it doesn't seem to work.
Therefore I need the following help:
- How do I modify it to acheive my desired result?
- Can I set it up to run for each of my users when they open the sheet, and how?
- What do I need to do to tell Google it is safe to run and I know the developer?
The code follows:
function onOpen() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getActiveSheet(); var range = sheet.getRange("3:3"); var values = range.getValues(); var day = 24*3600*1000; var today = parseInt((new Date().setHours(0,0,0,0))/day); var ssdate; for (var i=0; i<values.length; i++) { try { ssdate = values[i][0].getTime()/day; } catch(e) { } if (ssdate && Math.floor(ssdate) == today) { sheet.setActiveRange(range.offset(0,i,1,1)); break; } }}