Bonjour, alors là je sèche,
J'ai utilisé un code toute la journée hier toute pour copier des valeurs dans des cellules pour les utiliser après sur des pages web.
Aujourd'hui, je copie / colle dans un autre fichier, première utilisation ok, je modifie plus bas dans le code et la plantage ?????
L'ancien code (OK):
Code modifié:
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
71
72
73
74
75
76
77
78
79
80
81 Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean) If Target.Column <> 2 And Target.Count = 1 Then Selection.Copy End If Dim STATUT As Variant, LigDEB As Double, LigFIN As Double If Target.Column = 2 Then STATUT = InputBox("STATUT: 0 = Debut de traitement / 1 = En cours de traiement / 2 = Traitement accompli", "STATUT: 0 = Debut de traitement / 1 = En cours de traiement / 2 = Traitement accompli") LigDEB = Selection.Row & vbNewLine LigFIN = Selection.Rows.Count - 1 + Selection.Row Select Case STATUT Case Is = 0 Rows(LigDEB & ":" & LigFIN).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 14540287 .TintAndShade = 0 .PatternTintAndShade = 0 End With Case Is = 1 Rows(LigDEB & ":" & LigFIN).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 49407 .TintAndShade = 0 .PatternTintAndShade = 0 End With Case Is = 2 Rows(LigDEB & ":" & LigFIN).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorDark1 .TintAndShade = -0.499984740745262 .PatternTintAndShade = 0 End With ActiveWorkbook.Save Case Is > 2 Exit Sub Case Is = "" Exit Sub Case Is = False Exit Sub End Select End If End Sub
Excel ne veut pas entendre parler de
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87 Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean) If Target.Column <> 2 And Target.Count = 1 Then Selection.Copy End If Dim STATUT As Variant, LigDEB As Double, LigFIN As Double If Target.Column = 2 Then STATUT = InputBox("STATUT: 0 = Debut de traitement / 1 = En cours de traiement / 2 = Traitement accompli", "STATUT: 0 = Debut de traitement / 1 = En cours de traiement / 2 = Traitement accompli") LigDEB = Selection.Row & vbNewLine LigFIN = Selection.Rows.Count - 1 + Selection.Row Cells(LigDEB, 1).Select Exit Sub Select Case STATUT Case Is = 0 Range(Cells(LigDEB, 3), Cells(LigFIN, 8)).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 14540287 .TintAndShade = 0 .PatternTintAndShade = 0 End With Case Is = 1 Range(Cells(LigDEB, 3), Cells(LigFIN, 8)).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 49407 .TintAndShade = 0 .PatternTintAndShade = 0 End With Case Is = 2 Range(Cells(LigDEB, 3), Cells(LigFIN, 8)).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .ThemeColor = xlThemeColorDark1 .TintAndShade = -0.499984740745262 .PatternTintAndShade = 0 End With ActiveWorkbook.Save Case Is > 2 Exit Sub Case Is = "" Exit Sub Case Is = False Exit Sub End Select End If End Subet plante dès le premier
Code : Sélectionner tout - Visualiser dans une fenêtre à part Selection, si je le supprime, sur
Code : Sélectionner tout - Visualiser dans une fenêtre à part Selection.Copy, retour d'erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part Selection.Row.
Code : Sélectionner tout - Visualiser dans une fenêtre à part Erreur de comilation Fonction ou variable attendue
Merci beaucoup pour vos aides, je n'y comprends rien là
Partager