Bonjour,

J'essaye sans succès de rajouter un zéro devant un numéro de mois et un numéro de semaine mon code m'a l'air ok je comprends pas pourquoi excel m'affiche toujours ce chiffre j'en appel donc à votre expertise
Voici mon code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Sub BDDPoCONF()
Dim i As Long
Dim Y As Integer, M As Integer, W As Integer
Dim table1 As Variant, table2 As Variant ' tableaux
Dim tabR As Variant
Dim dico As New Scripting.Dictionary    ' dictionnaires cles -> valeur
 
 
'Application.ScreenUpdating = False
Worksheets("BDD PO_Conf v2").Rows("1:1").Delete Shift:=xlUp
Worksheets("BDD PO_Conf v2").Range("A:H,J:J,L:N,P:AD,AG:BQ").Delete Shift:=xlToLeft
 
With Worksheets("BDD PO_Conf v2")
 
LR1 = Worksheets("BDD PO_Conf v2").Range("A" & Rows.Count).End(xlUp).Row
For Each ObjCell In Range(Cells(2, 4), Cells(LR1, 4))
                If ObjCell.Value = "" Then GoTo Line1
                    A = Right(ObjCell.Value, 4)
                    M = Mid(ObjCell.Value, 4, 2)
                    D = Left(ObjCell.Value, 2)
                    ObjCell.Value = DateSerial(A, M, D)
Line1:
            Next
 
    For i = 2 To LR1
        If Range("B" & i).Value = "Seafreight EDI" Then
                Range("H" & i).Value = Range("D" & i) + 48
            ElseIf Range("C" & i).Value = "Airfreight EDI collect" Or "Airfreight EDI prepaid" Then
                Range("H" & i).Value = Range("D" & i) + 12
            ElseIf Range("C" & i).Value = "Sea-air collect EDI" Then
                Range("H" & i).Value = Range("D" & i) + 25
            Else
                Range("H" & i).Value = "Pas de fret"
        End If
 
        Range("C" & i).Value = "L" & Range("C" & i).Value & "00"
 
        Y = Year(Range("H" & i).Value)
        If Len(Month(Range("H" & i).Value)) < 2 Then
                M = "0" & Month(Range("H" & i).Value)
            Else
                M = Month(Range("H" & i).Value)
        End If
        If Len(Format(Range("H" & i).Value, "ww")) < 2 Then
                W = "0" & Format(Range("H" & i).Value, "ww")
            Else
                W = Format(Range("H" & i).Value, "ww")
        End If
 
        Range("F" & i).Value = Y & "." & M
        Range("G" & i).Value = Y & "." & W
    Next i
        Range("F1").Value = "ETA month"
        Range("G1").Value = "Conf. Del. Week"
        Range("H1").Value = "ETA Date  "
 'voir pour rajouter le vlookup FAUX si déjà présent dans le BDD PO v2
 
End With
End Sub
Merci d'avance