Hello,
i have a mini bike rent and im trying to make a time tracking for my clients spent time
this is my code
if only 1 cell its work with this code :
i have a mini bike rent and im trying to make a time tracking for my clients spent time
this is my code
VBA Code:
Sub trycouunt()
Dim starts As Single
Dim cntup As Date
Dim cntdwn As Date
Set ws = ActiveSheet
Dim j As Long
Clock = Now + TimeValue("00:00:01")
starts = Timer
For i = 2 To 6
cntup = CellS(i, 1).Value 'this is part i cant understand why my code didnt work
cntdwn = CellS(i, 2).Value 'this is part i cant understand why my code didnt work
If CellS(i, 1).Value > 0 Then
CellS(i, 1).Value = cntup - (Timer - starts - 86400 * (starts > Timer)) / 86400
CellS(i, 2).Value = cntdwn + (Timer - starts - 86400 * (starts > Timer)) / 86400
End If
Next i
Application.OnTime Clock, "trycount"
End Sub
if only 1 cell its work with this code :
VBA Code:
Sub RunMe()
Dim starts As Single
Dim CellS As Range
Dim Cellt As Range
Dim CountUPS As Date
Dim CountUp As Date
'Timer is the number of seconds since midnight.
'Store timer at this point in a variable
starts = Timer
'Store A1 in a variable to make it easier to refer
'to it later. Also, if the cell changes, you only
'have to change it in one place
Set CellS = Sheet1.Range("A1")
CountUPS = Sheet1.Range("A1").Value
Set Cellt = Sheet1.Range("B1")
CountUp = Sheet1.Range("B1")
'b_pause = True
Do While CellS.Value > 0
CellS.Value = CountUPS - (Timer - starts - 86400 * (starts > Timer)) / 86400
Cellt.Value = CountUp + (Timer - starts - 86400 * (starts > Timer)) / 86400
DoEvents
Loop
End Sub