Bonjour,
C'est parce que tu as écris ça comme: "si une cellule ne contient pas "Qté" ou "Code" alors je supprime la colonne.
Une tentative:
Sub suprColonnes()
For i = ActiveSheet.UsedRange.Rows.Count To 1 Step -1
For j = ActiveSheet.UsedRange.Columns.Count To 1 Step -1
If Not Cells(i, j) Like "Qté" Or Not Cells(i, j) Like "Code" Then Columns(i).Delete
Next
Next
Dim ligFin As Long, colFin As Long
'initialisations
ligFin = Range("A" & Rows.Count).End(xlUp).Row
colFin = Cells(1, Columns.Count).End(xlToLeft).Column
For col = colFin To 1 Step -1
If WorksheetFunction.CountIf(Range(Cells(1, col), Cells(ligFin, col)), "Qté") + _
WorksheetFunction.CountIf(Range(Cells(1, col), Cells(ligFin, col)), "Code") = 0 Then
Cells(1, col).EntireColumn.Delete
End If
Next col
End Sub
Comme je n'avais pas plus de contexte j'ai pondu cette horreur...