Hi all I am trying to write a custom function that will be pasted in a row along a columns that are starting at 12:00 AM and move across till they reach 11:45 PM in 0:15 min increments. The row is 4 and 12 am starts at N4. The function will look to the row its in starting at n4 and compair that value to the start time for the client over in colum b5. What I wrote and thought should work is this
Function Schedule(START As Date, BRK1 As Date, LUNCH As Date, BRK3 As Date, endDAY As Date, ColTime As Date) As String
Select Case Time
Case Range(BRK1).Value - TimeSerial(0, 1, 0) To Range(BRK1).Value + TimeSerial(0, 1, 0)
Schedule = "B"
' I tired above incase for some reason the times do not match perfectly off a .0000001 or so. I also tried as below
Case LUNCH - TimeSerial(0, 1, 0) To LUNCH + TimeSerial(0, 30, 0)
Schedule = "L"
End Select
End Function
I still end up with #VALUE in cell. I wat the Schedule= value returned to cell the formula is in. I think it maybe formating issue with the values BRK1 ect.. I think may need Format(time??) or something like that. I thought by setting them as Date that would work?
Thanks in advance for any help clearing this up for me.
Function Schedule(START As Date, BRK1 As Date, LUNCH As Date, BRK3 As Date, endDAY As Date, ColTime As Date) As String
Select Case Time
Case Range(BRK1).Value - TimeSerial(0, 1, 0) To Range(BRK1).Value + TimeSerial(0, 1, 0)
Schedule = "B"
' I tired above incase for some reason the times do not match perfectly off a .0000001 or so. I also tried as below
Case LUNCH - TimeSerial(0, 1, 0) To LUNCH + TimeSerial(0, 30, 0)
Schedule = "L"
End Select
End Function
I still end up with #VALUE in cell. I wat the Schedule= value returned to cell the formula is in. I think it maybe formating issue with the values BRK1 ect.. I think may need Format(time??) or something like that. I thought by setting them as Date that would work?
Thanks in advance for any help clearing this up for me.