Bonjour
J'ai un Sub Worksheet_Change(ByVal Target As Range) dans lequel je surveille le changement de valeur dans 4 colonnes. Voici la routine qui fonctionne
SI je veux utiliser la fonction If Then j'ai un problème code 13 Mismatch à la ligne If Then. Voici la routine qui ne fonctionne pas
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 Private Sub Worksheet_Change(ByVal Target As Range) Dim Cellule As String Dim Column As Integer Dim Row As Integer Application.EnableEvents = False If Target.Row >= 14 Then Row = Target.Row Column = Target.Column Cellule = UCase(Target.Value) Select Case Column Case Is = 13, 14, 15, 16 Select Case Cellule Case Is = "CE" Call Calcul_Par_Ligne(Row) Call Sommation Case Is = "CO" Call Calcul_Par_Ligne(Row) Call Sommation Case Is = "M" Call Calcul_Par_Ligne(Row) Call Sommation Case Is = "F" Call Calcul_Par_Ligne(Row) Call Sommation Case Is = "E" Call Calcul_Par_Ligne(Row) Call Sommation Case Else MsgBox "Vous avez inscrit une mauvaise valeur" GoTo 10: End Select Case Else GoTo 10: End Select 10: End If Application.EnableEvents = True End Sub
Pourquoi selon vous j'ai ce problème ?
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 Private Sub Worksheet_Change(ByVal Target As Range) Dim Cellule As String Dim Column As Integer Dim Row As Integer Application.EnableEvents = False If Target.Row >= 14 Then Row = Target.Row Column = Target.Column Cellule = UCase(Target.Value) Select Case Column Case Is = 13, 14, 15, 16 If Cellule = "CE" Or "CO" Or "M" Or "F" Or "E" Then Call Calcul_Par_Ligne(Row) Call Sommation Else MsgBox "Vous avez inscrit une mauvaise valeur" GoTo 10: End If Case Else GoTo 10: End Select 10: End If Application.EnableEvents = True End Sub
Merci pour votre temps
Partager