R
Reeaz
Guest
Bonjour,
Voici mon code:
Public Sub essai()
x = Selection
x = Replace(x, " ", "")
x = Replace(x, "Days", "D")
x = Replace(x, "Weeks", "W")
x = Replace(x, "Months", "M")
x = Replace(x, "Years", "Y")
x = Replace(x, "Day", "D")
x = Replace(x, "Week", "W")
x = Replace(x, "Month", "M")
x = Replace(x, "Year", "Y")
x = Replace(x, "D", "D ")
x = Replace(x, "W", "W ")
x = Replace(x, "M", "M ")
x = Replace(x, "Y", "Y ")
tab1 = Split(x, " ")
resultat = 0
For b = 0 To UBound(tab1) - 1
x1 = tab1(b)
val1 = Mid(x1, 1, Len(x1) - 1)
unit1 = Right(x1, 1)
Select Case unit1
Case "D": x2 = Val(val1)
Case "W": x2 = Val(val1) * 7
Case "M": x2 = Val(val1) * 30
Case "Y": x2 = Val(val1) * 361
End Select
resultat = resultat + x2
Next b
resul = MsgBox("voila le resultat: " & resultat, vbInformation, "Test")
End Sub
Globalement, ce programme me retourne "resultat"
Je voudrai exploiter ce resultat dans une autre procedure voire un autre module, comment faire?
Merci beaucoup!!
Voici mon code:
Public Sub essai()
x = Selection
x = Replace(x, " ", "")
x = Replace(x, "Days", "D")
x = Replace(x, "Weeks", "W")
x = Replace(x, "Months", "M")
x = Replace(x, "Years", "Y")
x = Replace(x, "Day", "D")
x = Replace(x, "Week", "W")
x = Replace(x, "Month", "M")
x = Replace(x, "Year", "Y")
x = Replace(x, "D", "D ")
x = Replace(x, "W", "W ")
x = Replace(x, "M", "M ")
x = Replace(x, "Y", "Y ")
tab1 = Split(x, " ")
resultat = 0
For b = 0 To UBound(tab1) - 1
x1 = tab1(b)
val1 = Mid(x1, 1, Len(x1) - 1)
unit1 = Right(x1, 1)
Select Case unit1
Case "D": x2 = Val(val1)
Case "W": x2 = Val(val1) * 7
Case "M": x2 = Val(val1) * 30
Case "Y": x2 = Val(val1) * 361
End Select
resultat = resultat + x2
Next b
resul = MsgBox("voila le resultat: " & resultat, vbInformation, "Test")
End Sub
Globalement, ce programme me retourne "resultat"
Je voudrai exploiter ce resultat dans une autre procedure voire un autre module, comment faire?
Merci beaucoup!!