Automatiser la suppression des valeurs négatives

matrice1 Messages postés 39 Statut Membre -  
The_boss_68 Messages postés 967 Statut Membre -

Bonjour,

je cherche à automatiser la suppression négatives dans une colonne.

je n'arrive pas a enregistrer une macro en faisant:

Sélection de la colonne : Filtrer / clic droit petite flèche / Filtres Numerique / Supérieur ou égla à 0

Merci de votre aide.

www.cjoint.com/c/MDbslSrtjkN


Windows / Firefox 111.0

A voir également:

1 réponse

The_boss_68 Messages postés 967 Statut Membre 182
 

Bonsoir,

un essai en mettant ce code VBA

Sub Supprimer()
    Dim xRg As Range
    Dim xCell As Range
    Dim xTxt As String
    Dim I As Long
    On Error Resume Next
    xTxt = ActiveWindow.RangeSelection.Address
Sel:
    Set xRg = Nothing
    Set xRg = Application.InputBox("Sélectionner la plage:", "Information", xTxt, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    If xRg.Areas.Count > 1 Then
        MsgBox "Ne pas sélectionner plusieurs colonnes", vbInformation, "Information"
        GoTo Sel
    End If
    If xRg.Columns.Count > 1 Then
        MsgBox "Ne pas sélectionner plusieurs colonnes", vbInformation, "Information"
        GoTo Sel
    End If
    For I = xRg.Rows.Count To 1 Step -1
        If xRg.Cells(I) < 0 Then xRg.Cells(I).EntireRow.Delete
    Next
End Sub

Slts

0