The code has been updated to clear the Dashboard, that's why you weren't seeing updates.
Run StartSched to begin the Ontime process. It will run every minute. You can enter a cutoff time in this module for end of day.
To force turning off the Schedule update, run StopSched module. Let me know if you have any other questions
Dim TimeTo As Date
Sub checkUpdt()
Dim i, lr, lrd, k, f, g, v, x As Long
Dim sc, db As Worksheet
Set sc = Sheets("Students Checkin Time")
Set db = Sheets("Dashboard")
lrd = db.Cells(Rows.Count, 2).End(xlUp).Row
db.Range("B2:H" & lrd).ClearContents
lr = sc.Cells(Rows.Count, 1).End(xlUp).Row
k = 0: f = 0: g = 0: v = 2: x = 2
With sc
For i = 2 To lr
If .Cells(i, 1).Value = Date Then
If Format(.Cells(i, 4).Value, "hh:mm") <= Format(Now(), "hh:mm") _
And Format(.Cells(i, 5).Value, "hh:mm") > Format(Now(), "hh:mm") Then
db.Cells(2 + v, 2 + g).Value = .Cells(i, 3).Value
db.Cells(3 + v, 2 + g).Value = "Check in at:" & Format(.Cells(i, 4).Value, "hh:mm")
db.Cells(4 + v, 2 + g).Value = "Total Time:" & DateDiff("n", .Cells(i, 4).Value, Format(Now(), "hh:mm"))
k = k + 1
f = f + 1
g = g + 3
If f Mod 3 = 0 Then
v = v + 5
End If
If g Mod 9 = 0 Then
g = 0
End If
End If
End If
Next
End With
'MsgBox "updated"
StartSched
End Sub
Sub StartSched() 'this is the name of the macro that starts the OnTime
If Time > #10:45:00 PM# Then Exit Sub 'Use this time to end code at certain time
TimeTo = Now + TimeValue("00:01:00")
Application.OnTime TimeTo, "checkUpdt"
End Sub
Sub StopSched() ' This Macro ends the Ontime schedule
Application.OnTime TimeTo, "checkUpdt", , False
End Sub
Bookmarks