Bonjour a tous,
Desole pour le titre mais je ne savais pas comment expliquer mon probleme simple en quelques mots.
Aux lignes 53, 58, 63 j'essai de modifier la cellule a quoi correspond ma variable Cel2. J'aimerais la modifer en prenant la cellule qui est juste en dessous. Ai-je bien code ces lignes pour que cela reponde a ce que je souhaite faire ?
Merci d'avance !
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
70 Sub Test() Dim Cel1 As Range Dim Cel2 As Range Dim Plage As Range Dim Cel As Range Dim mydate As Date Dim Month_date(2) As Integer Month_date(0) = 0 Month_date(1) = 0 Month_date(2) = 0 Set Cel1 = Sheet2.Range("B2") Set Cel2 = Sheet3.Range("J18") Set Plage = Range("B2:B20") For Each Cel In Plage If InStr(Cel.Value, "LP_LME") <> 0 Then For i = 0 To 2 mydate = Cel1.Offset(i, 3).Value If Month(mydate) = 8 Then Month_date(0) = 1 ElseIf Month(mydate) = 9 Then Month_date(1) = 1 ElseIf Month(mydate) = 10 Then Month_date(2) = 1 End If Next i End If Next Cel For n = 0 To 2 If Month_date(n) = 1 And n = 0 Then Cel2.Offset(0, 0).Value = "August" Set Cel2 = Cel2.Offset(1, 0) ElseIf Month_date(n) = 1 And n = 1 Then Cel2.Offset(0, 0).Value = "September" Set Cel2 = Cel2.Offset(1, 0) ElseIf Month_date(n) = 1 And n = 2 Then Cel2.Offset(0, 0).Value = "October" Set Cel2 = Cel2.Offset(1, 0) End If Next n End Sub
Partager