When the regional format date separator, time separator is set to ":" and further when tried to do the following it gives the runtime error 13 type mismatch
Public Function RndTime() As String
Dim VTime As Date
VTime = "11:" & Minute(Time) & ":" & Second(Time) & " PM"
VTime = DateAdd("h", Int(Rnd * 7), CTime)
RndTime = Format(VTime, "hh:mm AMPM")
Note: the purpose of the function is to return a time between 11 PM and 6 AM
where as when the separator is different for date, time it works fine
What could be the solution to this?