Hello all,
So I have a userform that tracks credits throughout a month. I need to keep a running tally of the credits given on the current day. This is what I have. It runs through the loop once, and quits. It's very annoying. Please for your assistance I will be grateful.
So I have a userform that tracks credits throughout a month. I need to keep a running tally of the credits given on the current day. This is what I have. It runs through the loop once, and quits. It's very annoying. Please for your assistance I will be grateful.
Code:
Function CalcDlyTtl() As Long
Dim i As Long
Dim l As Long
Dim iRow As Long
Workbooks(FileNameIs).Activate
ActiveWorkbook.Worksheets("OCCData").Activate
l = 0
iRow = ActiveSheet.Cells(Rows.Count, 1) _
.End(xlUp).Row
With ActiveSheet
For i = 1 To iRow
MsgBox (.Cell(i, 6).Value)
If Format(.Cell(i, 8).Value, "MM-DD") = Format(Now, "MM-DD") _
Then
l = l + .Cell(i, 6).Value
End If
Next
End With
ThisWorkbook.Activate
CalcDlyTtl = l
End Function