Option Explicit
Sub GARDERCOLONNES()
Application.ScreenUpdating = False
Dim Noms As Variant
Dim lgCol As Long
Dim rngCols As Range
Noms = Array("Nom", "Numéro Emplacement", "Numéro VdP 1", "Numéro VdP 2", "1 Recto", "1 Verso", "2 Recto", "2 Verso")
With ThisWorkbook.Sheets("MEF")
With .Range("A1").CurrentRegion
For lgCol = 1 To .Columns.Count
'
' Si le texte de la cellule n'est pas dans le tableau des noms
' de colonnes à conserver
If IsError(Application.Match(Trim(.Cells(1, lgCol)), Noms, 0)) Then
'
' Commenter la ligne ci-dessous après test
Debug.Print .Cells(1, lgCol)
'
' Créer la plage des colonnes à supprimer
' ou ajouter la colonne à la plage créée précédemment
If rngCols Is Nothing Then
Set rngCols = .Cells(1, lgCol)
Else
Set rngCols = Union(rngCols, .Cells(1, lgCol))
End If
End If
Next
End With
'
' si la plage des rngCols est initialisée
' supprimer les colonnes entières
If Not rngCols Is Nothing Then rngCols.EntireColumn.Delete
End With
Application.ScreenUpdating = True
End Sub