Time Tracker

GreenLanternX

New Member
Joined
Mar 17, 2023
Messages
6
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
  2. Web
Morning everyone,

Just joined, and am hoping I can get some help.

I've created a time tracker, to help me accurately track what I'm working on.

The macro I created logs the time using =now().

Currently column A is named "what are you working on" - column B is the task description. Column C is start time; Column D end time and Column E total time.

I'm only inputting timestamps in two columns (D & E). However I have to 'manually' move to a blank cell each time my time stamp macro is run; ie the next column or row based on the sequence.

Is there any code I can add that would automatically move the cell between the two columns and below a row each time the macro is run?

I'm new yo VBA and have only got this far by using YT.

Never joined a forum before so hoping it's a good experience.

Thanks in advance
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Can you please share your code so that we can see what you have so far, I think you want it to then move to same row column E (if you've just entered a time in column D) or next row column D if you've just entered a time in column E?
 
Upvote 0
Hi and thanks for taking the time out to have a look. See formula below ❤️

Sub Macro8 ()

• Macro8 Macro

Macro8

ActiveCell.FormulaR1C1 = "=NOW () "

Selection.NumberFormat =

"h:mm:ss"

Selection.Copy

Selection.PasteSpecial Paste: =xlPasteValues, Operation:=x1None, SkipBlanks

:=False, Transpose:-False

Application.CutCopyMode = False

End Sub
 
Upvote 0
CE6036D5-B68F-4DB4-8133-9317AB1178B0.jpeg
CF0379A8-6C48-4FE4-A51F-5B871C039938.jpeg
 
Upvote 0
All I'm looking for is to fill out columns E and F with time stamps when I run the macro.

I'd like to add something to the code that works out which box is next in sequence and the cell be actively waiting in that cell after the macro is run.

It would just save me from manually selecting the next cell. Whether that's the start or end time in the respective row or column

Hope that makes sense.
 
Upvote 0
Try something like this......

Sub LogTime()
'
' Go to next empty cell
' and enter time in that cell
'
Dim Alrow As Long
Dim EventTime As Double
'
EventTime = Time
Alrow = Range("E65536").End(xlUp).Row
'
If Range("F" & Alrow).Value > 0 Then
'
' End time already exists
' Enter start time on new row
'
Alrow = Alrow + 1
Range("E" & Alrow).Value = EventTime
Else
'
' Enter end time on current row
'
Range("F" & Alrow).Value = EventTime
End If
'
End Sub
 
Upvote 0
Hi I got the following error appear when running this?

Also will I add this to the existing code I had or will what you propose replace the old code?

Thanks again for your support and help everyone
6DC02B3D-EC1A-416C-B652-821B643AEE77.jpeg
 
Upvote 0
Hi I got the following error appear when running this?

Also will I add this to the existing code I had or will what you propose replace the old code?

Thanks again for your support and help everyoneView attachment 87825

You left out the following If statement......

'
If Range("F" & Alrow).Value > 0 Then
'

Also this should replace your code

Regards,

Max
 
Upvote 0

Forum statistics

Threads
1,215,403
Messages
6,124,710
Members
449,182
Latest member
mrlanc20

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