返回列表 发帖

Excel Question re: Time

Let's say in cell A5 I want to enter the time when cell A4 has something in it.

The problem is, if(isblank(A4),"",now()), will automatically recalulate the time everytime I press enter or F9. Is there a way to create a static time? Or do I have to automate a copy-paste special - value command and have it automatically run it when a time is entered?

No one? I was really hoping an easy answer existed for this.

I'll just program it in VBA I guess.

TOP

Not sure what you're asking for... you don't want the current time, so what time do you want the cell to show?

TOP

I want the current time when the data is entered. I want this time to remain and not change.



Edited 2 time(s). Last edit at Monday, July 11, 2011 at 07:16PM by kant.

TOP

This should work:

Right-click the tab > View Code

Then paste this in:

Private Sub Worksheet_Change(ByVal Target As Range)

If Intersect(Target, Range("A4")) Is Nothing Then

Else: Range("A5").Value = Time

End If

End Sub


--------------

Edit: You can replace the word "Time" with either "Now" or "Date" depending on how you want the date/time to read.



Edited 1 time(s). Last edit at Monday, July 11, 2011 at 08:59PM by LukeBBC251.

TOP

返回列表