Problem with time formula!

O.K. here it is!!!

I'm working on some sort of TimeCard.
Use in my sheet, vlookup, Now() and that kind of formulas.

Let's say I put Work Code like P1 in cell B4, that enters Description of kind of my work in D4 and start time in cell E4. After a minute I enter second work code in B5, that enters End time in F4 and How much time I needed for first event in G4 for first event and descrption for second event in D5 + start time in E5.

Problem is when I enter second event,
all times are the same so I can't calculate How much I use for first event.
I can solve this by macro, but I would like to solved this with formula.

Sebastian
Sebastian20Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
sblawrenceConnect With a Mentor Commented:
Well, hey thanks for re-editing - it was best advice I could give (heavy irony intended).
0
 
sblawrenceCommented:
You're using =now() as a formula in a cell? As soon as you do this all other cells will update with any changes. I think you will need to do this in VBA. By updating the cell with VBA, the cell contains a value that is 'now' not a formula that will change.
Try the following code:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If ActiveCell.Column = 2 Then
    ActiveCell.Offset(-1, 3).Range("a1").Select
    ActiveCell = Now()
    ActiveCell.Offset(-1, 1).Range("a1").Select
    ActiveCell = Now()
    ActiveCell.Offset(2, -4).Range("a1").Select
End If
End Sub

This will (if I've read your query right) update the cells you need updating as soon as you enter anything in the second column.
0
 
Sebastian20Author Commented:
Edited text of question.
0
 
Sebastian20Author Commented:
Thanks for anwser!!!
Sebastian
0
All Courses

From novice to tech pro — start learning today.