Effacer entierement ligne par son N°

loisphil

XLDnaute Nouveau
bonsoir forum
dans un usf j'ai une cbx qui sert a rappeler la feuil selectionnee
les données de cette feuil sont copier dans les tbx et cbx prevu.
dans une de ces tbx un numero est copié
par ce numero je voudrai supprimer (la ligne complete)
de la feuil nommée "repertoire" ou tous les numero sont inscrit
merci pour votre aide


Private Sub CommandButton9_Click()
Dim I As Long
Dim Plage As Range

rep = ComboBox10.Value
For Each Feuille In Worksheets
If Feuille.Name Like rep Then
Feuille.Delete

Set Plage = Sheets("Répertoire").Range("A2:A" & Range("A").End(xlUp).Row)
For I = Plage.Cells.Count To 1 Step -1
If Plage.Cells(I).Value = TextBox2.Value Then
Plage.Cells(I).EntireRow.Delete
End If

Next
End If
Next Feuille
End Sub
 

kjin

XLDnaute Barbatruc
Re : Effacer entierement ligne par son N°

Bonsoir,
Je ne vois pas de rapport entre le début et la fin de la macro, donc pourquoi imbriquer les procédures ???
Code:
Private Sub CommandButton9_Click()
Dim Ws As Worksheet, Cel As Range

For Each Ws In Worksheets
    If Ws.Name Like ComboBox10 Then
        Application.DisplayAlerts = False
        Ws.Delete
        Application.DisplayAlerts = True
    End If
Next
With Sheets("Répertoire")
    For Each Cel In .Range("A2:A" & .Range("A65000").End(xlUp).Row)
        If Cel = TextBox2 Then Cel.EntireRow.Delete
    Next
End With

End Sub
A+
kjin
 
Dernière édition:

kjin

XLDnaute Barbatruc
Re : Effacer entierement ligne par son N°

Re,
Pas très clair !
Que contient la textbox2 ?
Un numéro quelconque ?
Code:
'...
With Sheets("Répertoire")
    For Each Cel In .Range("A2:A" & .Range("A65000").End(xlUp).Row)
        If Cel = CLng(TextBox2) Then Cel.EntireRow.Delete
    Next
End With
'...
Un numéro de ligne ?
Code:
'...
With Sheets("Répertoire")
    .Rows(CLng(TextBox2)).Delete
End With
'...
A+
kjin
 

loisphil

XLDnaute Nouveau
Re : Effacer entierement ligne par son N°

Un numéro quelconque et ca fonctionne !!
avec ce code
With Sheets("Répertoire")
For Each Cel In .Range("A2:A" & .Range("A65000").End(xlUp).Row)
If Cel = CLng(TextBox2) Then Cel.EntireRow.Delete
Next
End With
reste plus qu'a trouver un volontaire pour alleger ce fichier !!

MERCI kjin pour ton temps !!
 

Discussions similaires

Réponses
4
Affichages
251
Réponses
7
Affichages
452

Statistiques des forums

Discussions
312 754
Messages
2 091 683
Membres
105 047
dernier inscrit
Jeannot