besoin d'aide pour modification formule vba

marleauc

XLDnaute Occasionnel
RÉSOLU MERCI

bonjour voici mon défi, j'aimerais modofier le format heure pourqu"il n"y ait pas de :)) entre ;es HH et MM
j'aimerai 1200 et non 12:00 dans ma dbase est ce possible ou modier le code pourque le textbox4 soit en numerique
voici la commande
Function Saisie_heure(S As String) As String
Select Case Len(S)
Case 1: If S = "" Then S = ""
Case 2: If Mid(S, 2, 1) = "" Then S = "0" & S Else S = S & ""
Case 4: If Mid(S, 4, 1) = "" Then S = Left(S, 3)
Case 5: If Mid(S, 5, 1) = "" Then S = Left(S, 4)
End Select
Saisie_heure = S
End Function


Function H_decode(Sn As Variant) As String
Dim S As String
S = Replace(CStr(Sn), ",", "")
If Mid(S, 2, 1) = "" Then S = "0" & S
If Left(Right(S, 2), 1) = "" Then S = S & "0"
H_decode = Format(CDate(S), "hhnn")
End Function


' code heure vers database, permet h>23:59
Function CodeH(S As String) As Single
Dim T() As String
CodeH = 0
If Not S = "" Then
T = Split(S, "")
CodeH = (T(0) * 1) + CSng(CDate("nn" & T(1))) * 24
End If
End Function


' lecture heure d'un database, permet h>23:59
Function DecodeH(S As Single) As String
DecodeH = IIf(S > 24, Int(S) & Format((S - 24) / 24, "nn"), Format(S / 24, "hhmm"))
End Function
merci christian
 
Dernière édition:

Discussions similaires

Réponses
2
Affichages
98