boomer1974
MIS
Good day experts,
I have a simple sub here it adds to "y" a given amt for each time each weekday occurs between two dates. I now need to do this by the hour. Everytime the clock rolls from 5:00 PM to 6:00 PM I have to add to "y" I realize I can do this by formatting and looping through every hour, however this is very slow. Would anyone have any suggestions on a more efficient way ? As always, any help would be greately appreciated.
For x = Date1 To date2
If Weekday(x) = 1 Then y = y + 690
If Weekday(x) = 7 Then y = y + 1380
If Weekday(x) = 2 Then y = y + 180
If Weekday(x) = 3 Then y = y + 180
If Weekday(x) = 4 Then y = y + 180
If Weekday(x) = 5 Then y = y + 180
If Weekday(x) = 6 Then y = y + 180
Next x
I have a simple sub here it adds to "y" a given amt for each time each weekday occurs between two dates. I now need to do this by the hour. Everytime the clock rolls from 5:00 PM to 6:00 PM I have to add to "y" I realize I can do this by formatting and looping through every hour, however this is very slow. Would anyone have any suggestions on a more efficient way ? As always, any help would be greately appreciated.
For x = Date1 To date2
If Weekday(x) = 1 Then y = y + 690
If Weekday(x) = 7 Then y = y + 1380
If Weekday(x) = 2 Then y = y + 180
If Weekday(x) = 3 Then y = y + 180
If Weekday(x) = 4 Then y = y + 180
If Weekday(x) = 5 Then y = y + 180
If Weekday(x) = 6 Then y = y + 180
Next x