# how to create a time cell

#### omairhe

##### Well-known Member
looking for a time cell...
just an example to understand what i want to achieve here.
suppose i have 5 Cells.. A3 B3 C3 D3 and E3

It all starts from a single Cell .. F3

so if F3 = ChangeValue
then E3 = old value of F3 before Change
and D3 = old value of E3 before change
and C3 = old value of D3 before change
and B3 = old value of C3 before change
finally A3 = old value of B3 before change

Its a chain reaction...

A picture demonstration where each time 100 is Added in cell F3...

help will be appreciated..
Thank You

Last edited:

### Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

#### BrianB

##### Well-known Member
You have done the hard bit. Just replace your "pseudocode" with "real" code.

The only difference being that you put it in reverse order so this bit is LAST
Code:
``````'- pseudocode
F3 = ChangeValue``````

Last edited:

#### omairhe

##### Well-known Member
You have done the hard bit. Just replace your "pseudocode" with "real" code.

The only difference being that you put it in reverse order so this bit is LAST
Code:
``````'- pseudocode
F3 = ChangeValue``````

Hey Brian Thanks for the Post.. im kindof still new to learning Excel Vba and stuff... could you kindly tell how to put this code in worksheet? also is there a formula for all this?

#### BrianB

##### Well-known Member
You can only do this with code because one you overwrite a cell value it is lost.

Code:
``````'=============================================================================
'- CHANGE CELL VALUES WHEN CELL F3 IS DOUBLE CLICKED
'- This code goes into sheet code module
'- Right click tab. View Code.
'=============================================================================
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim C As Integer    ' column
Dim NewValue As Variant
'-------------------------------------------------------------------------
'- InputBox for new cell value
NewValue = InputBox("New Value for cell", " NEW VALUE")
If NewValue = "" Then Exit Sub
'----------------------------------------------------------------------
'- Change cell values columns A to E to value in next cell'
For C = 1 To 5
Cells(3, C).Value = Cells(3, C + 1).Value
Next
'----------------------------------------------------------------------
'- PUT NEW VALUE IN F3
Range("F3").Value = NewValue
Beep
'----------------------------------------------------------------------
End If
End Sub
'------------------------------------------------------------------------------``````

#### omairhe

##### Well-known Member
Hi Brian...
just to seal the deal could you please alter code for not a double click event but for when value is changed even without touching the cell F3...
reason for me to want this is I can achieve a history of my past values that i feed in cell and i always feel like if i had enter the correct value and by doing this code i could easily review my values in real time.

Many thanks for your effort ...

#### omairhe

##### Well-known Member
Could anyone make a suggestion please??
Help will be appreciated.

Replies
23
Views
237
Replies
6
Views
121
Replies
28
Views
471
Replies
4
Views
131
Replies
3
Views
80

1,128,107
Messages
5,628,731
Members
416,333
Latest member
Time2Learn

### 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.

### Which adblocker are you using?

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

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