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

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,223,642
Messages
6,173,510
Members
452,518
Latest member
SoerenB

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