XL 2016 RESOLU suppression phrase

MASSJIPE

XLDnaute Impliqué
Bonjour le forum
Je voudrais supprimer les lignes complète de ces deux phrases par VBA
fonctionnement incomplet-vitre mobile porte AVG
fonctionnement incomplet-vitre mobile porte AVD
Merci
 

job75

XLDnaute Barbatruc
Bonjour MASSJIPE,

Voici 2 solutions :
Code:
Sub Suppr1()
Dim a, e, c As Range
a = Array("fonctionnement incomplet-vitre mobile porte AVG", _
    "fonctionnement incomplet-vitre mobile porte AVD")
For Each e In a
    Do
        Set c = Cells.Find(e, , xlValues, xlPart)
        If c Is Nothing Then Exit Do Else c.EntireRow.Delete
    Loop
Next
End Sub
Code:
Sub Suppr2()
Application.ScreenUpdating = False
Cells.Replace "*fonctionnement incomplet-vitre mobile porte AVG*", "#N/A"
Cells.Replace "*fonctionnement incomplet-vitre mobile porte AVD*", "#N/A"
On Error Resume Next 'si aucune SpecialCell
Cells.SpecialCells(xlCellTypeConstants, 16).EntireRow.Delete
End Sub
A+
 
Dernière édition:

MJ13

XLDnaute Barbatruc
Bonjour à tous

Suivant ce que je veux faire j'utilise un de ces codes:

Oups, je me suis trompé de post. :)

VB:
Sub Ferme_Et_Sauve_Juste_ce_Fichier()
'Ferme excel si seul ce fichier est ouvert
Dim w As Window
For Each w In Windows
If w.Caption = ThisWorkbook.Name Then GoTo suite
    'Workbooks(w.Caption).Close True
suite:
Next w
ThisWorkbook.Save
If Workbooks.Count = 1 Then  Application.EnableEvents = False: Application.Quit
End Sub

Sub Ferme_Tout_ET_Sauve()
Dim w As Window
For Each w In Windows
If w.Caption = ThisWorkbook.Name Then GoTo suite
    Workbooks(w.Caption).Close True
suite:
Next w
ThisWorkbook.Save
Application.EnableEvents = False
Application.Quit
End Sub

Sub Ferme_Tout_Rend_Visible_Et_Sauve()
Dim w As Window
For Each w In Windows
If w.Visible = False Then w.Visible = True
If w.Caption = ThisWorkbook.Name Then GoTo suite
    Workbooks(w.Caption).Close True
suite:
Next w
ThisWorkbook.Save
Application.EnableEvents = False
Application.Quit
End Sub

Sub Ferme_Tout_Sans_Sauver()
Dim w As Window
For Each w In Windows
If w.Caption = ThisWorkbook.Name Then GoTo suite
    Workbooks(w.Caption).Close False
suite:
Next w
ThisWorkbook.Close 0
End Sub
 
Dernière édition:

Discussions similaires

Statistiques des forums

Discussions
312 187
Messages
2 086 024
Membres
103 097
dernier inscrit
Benduch