View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
Peter T[_5_] Peter T[_5_] is offline
external usenet poster
 
Posts: 84
Default Add Hours by Looping through Data Q

It's still working fine for me, at least with your original test data. The
error suggests the value hIn is either 0 or above the ubound of the array.
Add these debugs after the original code lines as indicated

h = (dLast - dFirst) * 24
Debug.Print "h: "; h

hIn = Int(hIn)
Debug.Print i, "hIn: "; hIn

I get the following in the Immediate window (ctrl-g) with your data

h: 53
1 hIn: 2
2 hIn: 3
3 hIn: 4
4 hIn: 33
5 hIn: 48

Post your results

Regards,
Peter T