Modifier un algo

Résolu
jack2125 Messages postés 363 Date d'inscription   Statut Membre Dernière intervention   -  
ccm81 Messages postés 10909 Date d'inscription   Statut Membre Dernière intervention   -
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


5 réponses

ccm81 Messages postés 10909 Date d'inscription   Statut Membre Dernière intervention   2 433
 
Bonjour

Chez moi, ça fonctionne bien
https://www.cjoint.com/c/LEsjMDAnkjB

Cdlmnt

Lien modifié
0
jack2125 Messages postés 363 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
ccm81 Messages postés 10909 Date d'inscription   Statut Membre Dernière intervention   2 433
 
Set p = Range("A2:J3000")
tout simplement
0
jack2125 Messages postés 363 Date d'inscription   Statut Membre Dernière intervention  
 
super ca fonctionne
merci
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
ccm81 Messages postés 10909 Date d'inscription   Statut Membre Dernière intervention   2 433
 
De rien

Si c'est fini, peux tu mettre le sujet à résolu (en haut à droite dans ton premier post)
tu pourrais en profiter pour supprimer ton message de ce matin 9h11 qui m'a l'air de faire doublon avec celui-ci
https://forums.commentcamarche.net/forum/affich-37596302-supression-de-ligne-vide-dans-tableau-excel

Bon après midi
0