* Bonjour, *

Cette macro me supprime toutes les lignes pour lesquelles j'ai "" en colonne 7
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
Set oRng = Range("Ma plage")
v = oRng.Formula
W = oRng.Value
oRng.ClearContents
 
y = 1
For x = 1 To UBound(v, 1)
    If W(x, 7) <> vbNullString Then
        For z = 1 To UBound(v, 2)
            v(y, z) = v(x, z)
        Next z
        y = y + 1
    End If
Next x
 
For x = y To UBound(v, 1)
    For z = 1 To UBound(v, 2)
        v(x, z) = Empty
    Next z
Next x
 
oRng.Value = v
 
Set oRng = Nothing
v = Empty
W = Empty
J'aimerai réutiliser cette macro pour supprimer toutes les lignes pour lesquelles j'ai un chiffre différent de 5 à la colonne 7


J'ai essayé le code ci dessous mais ca ne marche 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
Set oRng = Range("Ma plage")
v = oRng.Formula
W = oRng.Value
oRng.ClearContents
 
y = 1
For x = 1 To UBound(v, 1)
    If W(x, 7) <> 5 Then
        For z = 1 To UBound(v, 2)
            v(y, z) = v(x, z)
        Next z
        y = y + 1
    End If
Next x
 
For x = y To UBound(v, 1)
    For z = 1 To UBound(v, 2)
        v(x, z) = Empty
    Next z
Next x
 
oRng.Value = v
 
Set oRng = Nothing
v = Empty
W = Empty
Merci de me lire