Transformer une date en valeur

tigeline001

XLDnaute Occasionnel
Bonjour tout le monde
j'ai une date sous cette forme "2016-04-19 11:07:23.000" et je voudrais la convertir en valeur mais en faisant le debogage il me dit incompatible type au niveau de l'instruction " tabloDte(ln, 1) = tabloDte(ln, 1) * 1 "voir code ci dessous
VB:
Dim  tabloDte, tabloM, ln&, v&, m As Byte, c

    Sheets("Indicateur_C").Range("CI16").CurrentRegion.Offset(1, 0).Clear
    Sheets("Indicateur_C").Range("CM17:CM28").ClearContents
   
    tabloDte = Sheets("Rapport_Intervention").Range("E2:E" & Range("E" & Rows.Count).End(xlUp).Row)
    For ln = 1 To UBound(tabloDte, 1)           'pour régler le pb des dates américaines
        tabloDte(ln, 1) = tabloDte(ln, 1) * 1     'on transforme les dates en valeurs
    Next ln
SVP ,quelqu'un peut m'indiquer là où se trouve l'erreur ou comment transformer ces genres de date.
Jai remarqué que si j'enléve les "000" à la fin au niveau de la date ça marche
Merci
 

tigeline001

XLDnaute Occasionnel
Excuse Cailllou
es ce qu'il ya possiblite avec le code suivant d'avoir le maximum par mois
VB:
Sub Compter_encore()
Dim Couleurs, MonDico, C, mRange, Last
Dim Plg
Dim Maxi, iMaxi
Dim DMax As Variant
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Sheets("Rapport_Intervention")
Set ws2 = Sheets("Indicateur_C")
Set MonDico = CreateObject("Scripting.Dictionary")
'[E:F].ClearContents
Last = ws1.[A65000].End(xlUp).Row
Set mRange = ws1.Range("A2:A" & Last): mRange.Interior.ColorIndex = Null
For Each C In mRange
  If C <> "" Then MonDico.Item(C.Value) = MonDico.Item(C.Value) + 1
  Maxi = IIf(Maxi > MonDico.Item(C.Value), Maxi, MonDico.Item(C.Value))
  iMaxi = IIf(Maxi > MonDico.Item(C.Value), iMaxi, C)
Next C
ws2.[Y17].Resize(MonDico.Count) = Application.Transpose(MonDico.Keys)
ws2.[Z17].Resize(MonDico.Count) = Application.Transpose(MonDico.Items)
Last = ws2.[F65000].End(xlUp).Row
Set Plg = ws2.Range("Y17:Y" & Last)
DMax = Application.Max(MonDico.Items)
Sheets("Indicateur_C").Cells(Last + 2, "Z").Value = DMax
Sheets("Indicateur_C").Cells(Last + 2, "Y").Value = iMaxi
Sheets("Indicateur_C").Range("AB17").Value = DMax
End Sub
 

Discussions similaires

Statistiques des forums

Discussions
312 169
Messages
2 085 923
Membres
103 041
dernier inscrit
Ousmane