Modifier un algo

Résolu/Fermé
jack2125 Messages postés 335 Date d'inscription jeudi 5 septembre 2019 Statut Membre Dernière intervention 24 avril 2024 - Modifié le 18 mai 2022 à 10:34
ccm81 Messages postés 10853 Date d'inscription lundi 18 octobre 2010 Statut Membre Dernière intervention 24 avril 2024 - 18 mai 2022 à 14:04
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


A voir également:

5 réponses

ccm81 Messages postés 10853 Date d'inscription lundi 18 octobre 2010 Statut Membre Dernière intervention 24 avril 2024 2 404
Modifié le 18 mai 2022 à 11:39
Bonjour

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

Cdlmnt

Lien modifié
0
jack2125 Messages postés 335 Date d'inscription jeudi 5 septembre 2019 Statut Membre Dernière intervention 24 avril 2024
18 mai 2022 à 11:46
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 10853 Date d'inscription lundi 18 octobre 2010 Statut Membre Dernière intervention 24 avril 2024 2 404
18 mai 2022 à 11:53
Set p = Range("A2:J3000")
tout simplement
0
jack2125 Messages postés 335 Date d'inscription jeudi 5 septembre 2019 Statut Membre Dernière intervention 24 avril 2024
18 mai 2022 à 12:05
super ca fonctionne
merci
0

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

Posez votre question
ccm81 Messages postés 10853 Date d'inscription lundi 18 octobre 2010 Statut Membre Dernière intervention 24 avril 2024 2 404
18 mai 2022 à 14:04
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