Bonjour à toutes et tous,
J'ai récupéré (merci à son auteur) et utilisé le code ci dessous copié, certes il fonctionne très bien mais j'ai remarqué le problème suivant :
La macro efface toutes les colonnes à partir de IV (L1C256) certainement ce qui était la limite du nombre de colonne maxi avant excel 2007.
Malgré mes essais je n'arrive pas à adapter ce code pour tenir compte que mon fichier utilise des colonnes au delà de IV
Auriez vous une solution ?
Merci
Cordialement
Hugues
Sub Nettoie()
Dim Sht As Worksheet, DCell As Range, Calc As Long, Rien As String, Avant As Double, plage As Range
On Error Resume Next
Calc = Application.Calculation
With Application
.Calculation = xlCalculationManual
.StatusBar = "Nettoyage en cours..."
.EnableCancelKey = xlErrorHandler
.ScreenUpdating = True
End With
For Each Sht In Worksheets
Avant = Sht.UsedRange.Cells.Count
Application.StatusBar = Sht.Name & "-" & Sht.UsedRange.Address
If Sht.UsedRange.Address <> "$A$1" Or Not IsEmpty(Sht.[A1]) Then
Set DCell = Sht.Cells.Find("*", , , , xlByRows, xlPrevious)(2)
If Not DCell Is Nothing Then
Sht.Range(DCell, Sht.Cells([A:A].Count, 1)).EntireRow.Delete
Set DCell = Nothing
Set DCell = Sht.Cells.Find("*", , , , xlByColumns, xlPrevious)(, 2)
If Not DCell Is Nothing Then Sht.Range(DCell, Sht.[IV1]).EntireColumn.Delete
End If
Rien = Sht.UsedRange.Address
End If
Next Sht
Application.StatusBar = False
Application.Calculation = Calc
ActiveWorkbook.Save
End Sub