Hi Guys,
I came across a weird thing in VBA for Excel:
For our planning department I designed a sheet so that the expected delivery times automatically get uploaded to our database. The times get rounded down to the nearest half our and than I add two hours and generate a string to upload in the database. All works fine except for times between: 12:00 and 12:29 in the code below info2 becomes the value "0,5" (or half day/ 12:00)
The code above should come back with
"Verwachte lostijd tussen 12:00 en 14:00 SJAB"
but instead it gives me
"Verwachte lostijd tussen 00:00 en 14:00 SJAB"
I assume it has something to do with the formatting but i'm not quite sure.
I came across a weird thing in VBA for Excel:
For our planning department I designed a sheet so that the expected delivery times automatically get uploaded to our database. The times get rounded down to the nearest half our and than I add two hours and generate a string to upload in the database. All works fine except for times between: 12:00 and 12:29 in the code below info2 becomes the value "0,5" (or half day/ 12:00)
Code:
info3 = ActiveCell.Value
info2 = Application.WorksheetFunction.Floor(info3, 1 / (24 * 2))
info1 = info2 + 0.08333333333
info4 = "Verwachte lostijd tussen " & Format(info2, "hh:mm") & " en " & Format(info1, "hh:mm") & " SJAB "
"Verwachte lostijd tussen 12:00 en 14:00 SJAB"
but instead it gives me
"Verwachte lostijd tussen 00:00 en 14:00 SJAB"
I assume it has something to do with the formatting but i'm not quite sure.