Private Function funCalculaHoras(DataIni As Date, DataFim As Date) As Long
Dim Horas As Long
Horas = 0
Horas = (DateDiff("d", DataIni, DataFim) - 1) * 24
Horas = Horas + (24 - Format(DataIni, "hh")) - (Format(DataIni, "mm") * 100 / 60)
Horas = Horas + Format(DataFim, "hh") + (Format(DataFim, "mm") * 100 / 60)
funCalculaHoras = Horas
End Function
'numero dias entre duas datas
DateDiff("d", data1,data2)