GotToBeABetterWay
Technical User
thread705-1207464
The referenced thread is exactly what I was looking for (calculating business hours between two dates). When I run my query, the calculated hours appear, then I start getting error messages and the values disappear and are replaced with #Error.
When I debug, this is what gets highlighted:
'Initalize Start and End Date Times
[highlight #FCE94F]MyDates(1).MyHrs = DateDiff("n", TimeValue(StDt), EndTim)[/highlight]
MyDates(UBound(MyDates)).MyHrs = DateDiff("n", StrtTim, TimeValue(EndDt))
I've tried replacing the DateDiff formula with a straight number (e.g. MyDates(1).MyHrs = 8). That line still gets highlighted. MyDates(1).MyHrs seems to be the source of the error.
Any ideas on what I've done wrong?
Thanks.
The referenced thread is exactly what I was looking for (calculating business hours between two dates). When I run my query, the calculated hours appear, then I start getting error messages and the values disappear and are replaced with #Error.
When I debug, this is what gets highlighted:
'Initalize Start and End Date Times
[highlight #FCE94F]MyDates(1).MyHrs = DateDiff("n", TimeValue(StDt), EndTim)[/highlight]
MyDates(UBound(MyDates)).MyHrs = DateDiff("n", StrtTim, TimeValue(EndDt))
I've tried replacing the DateDiff formula with a straight number (e.g. MyDates(1).MyHrs = 8). That line still gets highlighted. MyDates(1).MyHrs seems to be the source of the error.
Any ideas on what I've done wrong?
Thanks.