Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Reduire le poids d'un fichier EXCEL

2 réponses
Avatar
albert
Bonjour

Il y a quelques mois sur le forum il y a eu discussions sur la façon de
réduire le poids d'un fichier EXCEL dans le quel plusieurs manipulations
avaient laisser des traces.

Je ne le retrouve pas, quelqu'un se rappelle ??

Merci de me faire savoir.

--
albertri-at-videotron.ca.invalid

2 réponses

Avatar
MichD
Bonjour,

Copie cette macro dans un module standard et exécute-la une fois
Est-ce que cela a un effet positif sur le poids de ton fichier?

'------------------------------------------------------------------
Sub test()
Dim Sh As Worksheet, DerLig As Long, DerCol As Integer
Dim ModeCalcul As String

Application.ScreenUpdating = False
ModeCalcul = Application.Calculation
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
On Error Resume Next
For Each Sh In ThisWorkbook.Worksheets
With Sh
If Not IsEmpty(.UsedRange) Then
DerLig = .Cells.Find(What:="*", _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row

DerCol = .Cells.Find(What:="*", _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
.Range(.Cells(1, DerCol + 1), .Cells(.Rows.Count, .Columns.Count)).Clear
.Range(.Cells(1, DerCol + 1), .Cells(.Rows.Count, .Columns.Count)).Delete
.Range(.Cells(DerLig + 1, 1), .Cells(.Rows.Count, .Columns.Count)).Clear
.Range(.Cells(DerLig + 1, 1), .Cells(.Rows.Count, .Columns.Count)).Delete
End If
End With
If Err <> 0 Then Err = 0
Next
Application.Calculation = ModeCalcul
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
'------------------------------------------------------------------
Avatar
albert
Bonjour MichD

Le fichier est passé de 2564 Ko à 304 Ko.
Problème de coloration de colonnes de la ligne 2 à la ligne 1 048 576 que la
personne a essayé de supprimer de diverses façons.

Un grand merciJe garde précieusement

Albert

"MichD" a écrit dans le message de
news:mri7dg$7f7$
Bonjour,

Copie cette macro dans un module standard et exécute-la une fois
Est-ce que cela a un effet positif sur le poids de ton fichier?

'------------------------------------------------------------------
Sub test()
Dim Sh As Worksheet, DerLig As Long, DerCol As Integer
Dim ModeCalcul As String

Application.ScreenUpdating = False
ModeCalcul = Application.Calculation
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
On Error Resume Next
For Each Sh In ThisWorkbook.Worksheets
With Sh
If Not IsEmpty(.UsedRange) Then
DerLig = .Cells.Find(What:="*", _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row

DerCol = .Cells.Find(What:="*", _
LookIn:=xlFormulas, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
.Range(.Cells(1, DerCol + 1), .Cells(.Rows.Count,
.Columns.Count)).Clear
.Range(.Cells(1, DerCol + 1), .Cells(.Rows.Count,
.Columns.Count)).Delete
.Range(.Cells(DerLig + 1, 1), .Cells(.Rows.Count,
.Columns.Count)).Clear
.Range(.Cells(DerLig + 1, 1), .Cells(.Rows.Count,
.Columns.Count)).Delete
End If
End With
If Err <> 0 Then Err = 0
Next
Application.Calculation = ModeCalcul
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
'------------------------------------------------------------------