How to keep time stamp unchanged if any changes in the the other data cell?

azar3

New Member
Joined
Feb 19, 2020
Messages
7
Office Version
  1. 365
hi to all
I was trying for a script, so if any filling in the "name" column B, there will be a stamp time in "time in" column D & also for (status & "time out") column's (G&E), with keeping the time static for any changes in column(B&G) - I have a script and link below for what i need , but i don't now why the time appear also in c column
link: TIME STAMP2
script:
function onEdit(e) {

var rng = e.range;
var sheet = rng.getSheet().getSheetName()

//1.Change 'Sheet1' to be matching your sheet name
if (sheet =='Sheet1') {
switch(rng.getColumn()){
// if column B changed add timestamp in column D
case 2:
rng.offset(0,2).setValue(new Date()); //.setNumberFormat("MM/dd/yyyy hh:mm");
// if column G changed add timestamp in column H
case 7:
rng.offset(0,1).setValue(new Date()); //.setNumberFormat("MM/dd/yyyy hh:mm");
break;
default:
break;
}
}
};
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top