want to track time while paste value in multiple column of same roe

V

viveksingh

hi,

I have write a function to track when spreadsheet cell have edited. To achieve this I written below script and it's working fine.
But when I/Team copy paste multiple value then it is not working for all cell only current selected cell reference value(timestamp) updating.

Can you help me what things need to be change to execute function on for more that one selected cells copy/paste value.

Current running code for first scenario is :

function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "TrackTimeStamp" ) { //checks that we're on the correct sheet
var r = s.getActiveCell();
if( r.getColumn() == 2 ) { //checks the column
var nextCell = r.offset(0, 1);
//if( nextCell.getValue() === '' ) //is empty?
var time = new Date();
time = Utilities.formatDate(time, "IST", "HH:mm:ss");
nextCell.setValue(time);
};
};
}
 
G

GS

hi,
I have write a function to track when spreadsheet cell have edited.
To achieve this I written below script and it's working fine. But
when I/Team copy paste multiple value then it is not working for all
cell only current selected cell reference value(timestamp) updating.

Can you help me what things need to be change to execute function on
for more that one selected cells copy/paste value.

Current running code for first scenario is :

function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
if( s.getName() == "TrackTimeStamp" ) { //checks that we're on the
correct sheet var r = s.getActiveCell();
if( r.getColumn() == 2 ) { //checks the column
var nextCell = r.offset(0, 1);
//if( nextCell.getValue() === '' ) //is empty?
var time = new Date();
time = Utilities.formatDate(time, "IST", "HH:mm:ss");
nextCell.setValue(time);
};
};
}

This script is not VBA and so I assume you're automating Excel via some
other language! Also, doesn't look very efficient to me (based how the
Excel objects can be accessed via the Application object)!<g>

It only retrieves the ActiveCell. You need to loop through 'Selection'
to process each cell.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top