ghosttech09
07-02-2011, 05:03 PM
Hi and thanks in advance to whom ever helps. I have to functions to add work hours as a 7 day total and 30 day total. Both have also a reset function as well if hours entered 2 days in a row as 0 then they both reset to 0 and on the 7 day if the hours entered as 0 on one day only the 7day total resets to 0.I have a drop down list in column C10:C375. Now My issue is whenever the dropdown lists a certain "text" I would like the 7 day total to reset regardless of the hours entered and if a 0 is entered afterwards then both the 30 day and 7 day totals reset. PLease help any further questions just ask.
Function MonthlySummary(Hrsworked) As Currency
Dim item As Variant
Dim zero As Boolean
zero = False
MonthlySummary = 0
For Each item In Hrsworked
If (item = "") Then item = 0
If ((zero = True) And (item = 0#)) Then MonthlySummary = 0# Else _
MonthlySummary = MonthlySummary + item
zero = False
If (item = 0#) Then zero = True
Next item
End Function
Function Workhrs(Hrsworked) As Currency
Dim item As Variant
Workhrs = 0#
For Each item In Hrsworked
If (item = "") Then Workhrs = 0#
If (item = 0#) Then Workhrs = 0# Else _
Workhrs = Workhrs + item
Next item
End Function
Above are the 2 Modules that are my functions as of right now.
Function MonthlySummary(Hrsworked) As Currency
Dim item As Variant
Dim zero As Boolean
zero = False
MonthlySummary = 0
For Each item In Hrsworked
If (item = "") Then item = 0
If ((zero = True) And (item = 0#)) Then MonthlySummary = 0# Else _
MonthlySummary = MonthlySummary + item
zero = False
If (item = 0#) Then zero = True
Next item
End Function
Function Workhrs(Hrsworked) As Currency
Dim item As Variant
Workhrs = 0#
For Each item In Hrsworked
If (item = "") Then Workhrs = 0#
If (item = 0#) Then Workhrs = 0# Else _
Workhrs = Workhrs + item
Next item
End Function
Above are the 2 Modules that are my functions as of right now.