Un bug dans mon code vba

Fermé
nicolas - Modifié le 26 sept. 2022 à 10:38
 nicolas - 26 sept. 2022 à 11:32

Bonjour,

du coup j'ai fait un petit programme pour filtrer des ligne ou j'ai la colonne  Y = 0

du coup le problème c'est que quand il trouve pas le 0 il bug 

vous pouvez m'aides svp

      With tmp.range("Y1:Y" & [Y65536].End(xlUp).Row)
         .Replace What:="0", Replacement:="", LookAt:=xlWhole
         .SpecialCells(xlCellTypeBlanks).EntireRow.Delete
            End With


Windows / Firefox 91.0

Windows / Firefox 91.0

A voir également:

2 réponses

f894009 Messages postés 17185 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 15 avril 2024 1 701
26 sept. 2022 à 11:00

Bonjour,

Soit vous traitez l'erreur ou ceci

Sub test()
    nb = Application.CountIf(Columns("Y"), 0)
    If nb > 0 Then
        With Worksheets("feuil1").Range("Y1:Y" & [Y65536].End(xlUp).Row)
            .Replace What:="0", Replacement:="", LookAt:=xlWhole
            .SpecialCells(xlCellTypeBlanks).EntireRow.Delete
        End With
    End If
End Sub
0

ça marche trés bien merci bcp monsieur

0