Bonjour à tous

J'aurais besoin de vos lumières, et je suis un peu perdu. J'ai une colone de Date, de prix et de jours fériés de l'année x dans la Feuil1. Une colone de Date de prix et de jours férié dans la Feuil2 de l'année y . Je souhaire réalisé une macro qui va chercher et faire correspondre Les valeurs de deux colones des jours férié des année x et y. Pour ensuite remplacer la valeurs du prix du jour férié x dans la Feuil1 par la valeur du prix correspondante du jour férié y de la Feuil2 . Pour être plus clair j'ai joint un petit fichier excel ( dans la zone de texte de la feuil1 ) qui récapitule tout mon petit soucis en détail.
Merci à vous !!!!"


Merci infiniment

PS : Par ailleurs je vous transmets un code que j'ai élaboré mais qui ne fonctionne pas apparemment...

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
60
61
62
63
64
65
66
67
68
69
 
Public Sub test()
 
 
Dim oShFeuil2 As Worksheet
Dim oShFeuil1 As Worksheet
Dim bFin As Boolean
Dim iLig As Integer
Dim dtDeb As Date
Dim iLigEcrite As Integer
Set oShFeuil1 = Worksheets("Feuil1")
Set oShFeuil2 = Worksheets("Feuil2")
 
dtDeb1 = oShFeuil2.Range("H2").Value
dtDeb2 = oShFeuil2.Range("H3").Value
dtDeb3 = oShFeuil2.Range("H4").Value
dtDeb4 = oShFeuil2.Range("H5").Value
dtDeb5 = oShFeuil2.Range("H6").Value
dtDeb6 = oShFeuil2.Range("H7").Value
dtDeb7 = oShFeuil2.Range("H8").Value
dtDeb8 = oShFeuil2.Range("H9").Value
dtDeb9 = oShFeuil2.Range("H10").Value
dtDeb10 = oShFeuil2.Range("H11").Value
dtFin = oShFeuil1.Range("H12").Value
 
iLigEcrite = 12
 
bFin = False
iLig = 2
While Not bFin
    If DateDiff("d", dtDeb1, oShFeuil2.Range("A" & iLig).Value) = 0 Then
        If DateDiff("d", dtDeb2, oShFeuil2.Range("A" & iLig).Value) = 0 Then
            If DateDiff("d", dtDeb3, oShFeuil2.Range("A" & iLig).Value) = 0 Then
                If DateDiff("d", dtDeb4, oShFeuil2.Range("A" & iLig).Value) = 0 Then
                    If DateDiff("d", dtDeb5, oShFeuil2.Range("A" & iLig).Value) = 0 Then
                        If DateDiff("d", dtDeb6, oShFeuil2.Range("A" & iLig).Value) = 0 Then
                            If DateDiff("d", dtDeb7, oShFeuil2.Range("A" & iLig).Value) = 0 Then
                                If DateDiff("d", dtDeb8, oShFeuil2.Range("A" & iLig).Value) = 0 Then
                                    If DateDiff("d", dtDeb9, oShFeuil2.Range("A" & iLig).Value) = 0 Then
                                        If DateDiff("d", dtDeb10, oShFeuil2.Range("A" & iLig).Value) = 0 Then
                                            If DateDiff("d", dtFin, oShFeuil2.Range("A" & iLig).Value) = 0 Then
 
    oShFeuil1.Range("F" & iLigEcrite).Value = oShFeuil2.Range("B" & iLig).Value
    iLigEcrite = iLigEcrite + 1
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If
    End If
    iLig = iLig + 1
 
    If oShFeuil2.Range("A" & iLig).Value = "" Then
    bFin = True
    End If
    Wend
 
    Set oShFeuil2 = Nothing
    Set oShFeuil1 = Nothing
 
 
    MsgBox "test ok !", vbInformation
 
    End Sub


MnExple.xlsxMnExple.xlsx