Effacer la valeur d'une cellule en fin d'execution du code
Bonjour,
J'ai un code VBA pour lequel la case V1 prend une valeur au cours de l'execution de celui-ci, cependant, je voudrais qu'en fin d'execution du code, V1 prenne la valeur "None".
J'ai essayé de mettre en fin de code:
Code:
1 2
| If range("V1").value <> "" then
range("V1").value = "None" |
Mais ça n'a pas fonctionné, j'ai aussi essayé de l'effecer avec clear, de changer ça valeur, mais rien ne fonctionne...
Voici mon code et merci d'avance pour votre aide:
Code:
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
| Private Sub Worksheet_Change(ByVal Target As Range)
n = Target.Row
Dim NumSafetyEasy As Long
For x = 1 To 17
If Cells(n, 1) <> "" And Cells(n, 6) <> "" And Cells(n, 7) = "Ok" And Cells(n, 9) <> "" And Cells(n, 11) <> "" And (Cells(n, 15) = "" Or Cells(n, 16) = "") Then
Cells(n, x).Interior.ColorIndex = 44
End If
If Cells(n, 4) = "SAE canceled" And Cells(n, 17) = "Validé" Then
Cells(n, x).Interior.ColorIndex = 41
End If
If Cells(n, 4) = "SAE canceled" And Cells(n, 17) = "Validé" Then
NumSafetyEasy = Cells(n, 6)
End If
If Cells(n, 4) = "SAE canceled" And Cells(n, 17) = "Validé" Then
Range("V1").Value = NumSafetyEasy
End If
If Application.Intersect(Range("V1"), Target) Is Nothing Then
For a = 9 To 100
For b = 1 To 17
If Cells(a, 6) = Range("V1").Value Then
Cells(a, b).Interior.ColorIndex = 2
End If
Next b '
Next a '
End If
Next x '
End Sub |