Modifier un algo

Résolu
jack2125 Messages postés 486 Date d'inscription   Statut Membre Dernière intervention   -  
ccm81 Messages postés 11033 Statut Membre -
Bonjour,
j'utilise c'est algo
il me demande la plage...
je voudrais l'imposer A2:J3000
est ce possible
Option Explicit

Const coG = 7
Const coH = 8
Const coF = 6
Const lideb = 2
Const codeb = 1

Sub sup()
Dim li As Long, co As Long, lifin As Long, cofin As Long
Application.ScreenUpdating = False
lifin = Cells(Rows.Count, codeb).End(xlUp).Row
cofin = Cells(lideb, Columns.Count).End(xlToLeft).Column
' traitement colonne G
For li = lideb To lifin
  If Cells(li, coG).Value = 0 Then
    Range(Cells(li, codeb), Cells(li, cofin)).ClearContents
  End If
Next li
' traitement colonne h
For li = lideb To lifin
  If Cells(li, coH).Value = 0 Then
    Range(Cells(li, codeb), Cells(li, cofin)).ClearContents
  End If
Next li

' traitement colonne F
For li = lideb To lifin
  If Cells(li, coF).Value <> "" Then
    If Cells(li, coF).Value < 75 Or Cells(li, coF).Value > 175 Then
      Range(Cells(li, codeb), Cells(li, cofin)).ClearContents
    End If
  End If
Next li

Dim p As Range, i As Long
Set p = Application.InputBox(Prompt:="Sélectionnez une plage", _
Title:=" Supprimer lignes vides", Type:=8)
With p
For i = .Rows.Count To 1 Step -1
If Application.CountA(.Rows(i)) = 0 Then _
.Rows(i).EntireRow.Delete 'ICI
Next i
End With
End Sub


Configuration: Windows / Edge 101.0.1210.47


vous êtes super!
merci à tous

5 réponses

  1. jack2125 Messages postés 486 Date d'inscription   Statut Membre Dernière intervention  
     
    merci de ta reponse
    oui ça marche très bien mais je voudrais m'éviter de taper la plage et de l'intégrer en automatique
    a2:j3000
    0
  2. ccm81 Messages postés 11033 Statut Membre 2 434
     
    Set p = Range("A2:J3000")
    tout simplement
    0
  3. jack2125 Messages postés 486 Date d'inscription   Statut Membre Dernière intervention  
     
    super ca fonctionne
    merci
    0
  4. Vous n’avez pas trouvé la réponse que vous recherchez ?

    Posez votre question