1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
Sub ajoutavecdate()
Dim a, I As Byte
Dim Dt
Dt = Calendard.Chargement(Caption:="Entrer une date") ' InputBox("Entrer une date")
If Dt = False Then MsgBox "ERR": Exit Sub
a = Split("Data_Système;Data_Troupeau;Data_Lait;Data_Ration;Data_Compta", ";")
For I = 0 To UBound(a)
With Sheets(a(I)).ListObjects(1).Range
.Rows(.Rows.Count).Copy .Rows(.Rows.Count + 1)
.Cells(.Rows.Count + 1, 1) = TrouveType(Dt)
End With
Next I
End Sub
Function TrouveType(V)
TrouveType = V
If IsDate(TrouveType) = True And InStr(TrouveType, "/") <> 0 And InStr(TrouveType, ":") <> 0 Then TrouveType = Format(TrouveType, "yyyy-mm-dd hh:mm"): Exit Function
If IsDate(TrouveType) = True And InStr(TrouveType, "/") <> 0 Then TrouveType = Format(TrouveType, "yyyy-mm-dd"): Exit Function
If IsNumeric(Replace(TrouveType, ".", ",")) = True Then TrouveType = Replace(TrouveType, ",", "."): Exit Function
End Function |
Partager