Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() The change makes no difference other than to highlight the lack of a declaration. I agree with your advice but I don't see how it was going to make any difference anyway. Here's the revised code with all variable declared. I also changed one of the if statements but that isn't relevant to the error: Option Explicit Function TimeDiff(BeginTime As Integer, EndTime As Integer) As Single Dim BeginHour As Integer, BeginMinute As Integer Dim EndHour As Integer, EndMinute As Integer If EndTime < BeginTime Then EndTime = EndTime + 2400 BeginHour = Int(BeginTime / 100) BeginMinute = BeginTime - (BeginHour * 100) BeginTime = (BeginHour * 60) + BeginMinute EndHour = Int(EndTime / 100) EndMinute = EndTime - (EndHour * 100) EndTime = (EndHour * 60) + EndMinute TimeDiff = (EndTime - BeginTime) / 60 End Function Function FindCase(Ws As Integer, We As Integer, Rs As Integer, Re As Integer) As Single Dim WsRs As Single, RsWe As Single, WsWe As Single, WsRe As Single, RsWs As Single, WeRe As Single, RsRe As Single, ReWe As Single WsRs = TimeDiff(Ws, Rs) RsWe = TimeDiff(Rs, We) WsWe = TimeDiff(Ws, We) WsRe = TimeDiff(Ws, Re) RsWs = TimeDiff(Rs, Ws) RsRe = TimeDiff(Rs, Re) WeRe = TimeDiff(We, Re) FindCase = 0 If WsRs + RsWe = WsWe Then FindCase = FindCase + 1 If RsWs + WsWe + WeRe = RsRe Then FindCase = FindCase + 10 If WsRe + ReWe = WsWe Then FindCase = FindCase + 100 If WsRs + RsRe + ReWe = WsWe Then FindCase = FindCase + 1000 End Function -- millsy ------------------------------------------------------------------------ millsy's Profile: http://www.excelforum.com/member.php...fo&userid=5122 View this thread: http://www.excelforum.com/showthread...hreadid=494261 |