Ciao JP3BO,
ho costruito una cartella di lavoro abbastanza complessa, ma in qualche passaggio alcuni fogli si sono attivati fino a 1 milione di righe facendo esplodere il peso del file e la gestione di calcolo.
Ho consultato alcuni forum che suggeriscono di delimitare l'area inutile e di eliminarla per fare tornare il tutto ad un peso accettabile, ma i miei tentativi in tal senso (selezione + elimina righe) sono stati inutili; l'alternativa di creare un nuovo foglio
e incollare le celle è, oltre che inutilmente laboriosa, difficile in quanto per copiare la vasta area che mi sarebbe utile mi dice che comunque esaurisce le disponibilità del sistema.
Prova qualcosa del genere:
- Alt+F11 per aprire l'editor di VBA
- Alt+IM per inserire un nuovo modulo di codice
- Nel nuovo modulo vuoto, incolla il seguente codice:
'=========>>
Option Explicit
'--------->>
Sub DeleteUnused()
'\ Debra Dalgleish
'\ http://www.contextures.com/xlfaqApp.html#Unused
Dim myLastRow As Long
Dim myLastCol As Long
Dim wks As Worksheet
Dim dummyRng As Range
For Each wks In ActiveWorkbook.Worksheets
With wks
myLastRow = 0
myLastCol = 0
Set dummyRng = .UsedRange
On Error Resume Next
myLastRow = _
.Cells.Find("*", after:=.Cells(1), _
LookIn:=xlFormulas, lookat:=xlWhole, _
searchdirection:=xlPrevious, _
searchorder:=xlByRows).Row
myLastCol = _
.Cells.Find("*", after:=.Cells(1), _
LookIn:=xlFormulas, lookat:=xlWhole, _
searchdirection:=xlPrevious, _
searchorder:=xlByColumns).Column
On Error GoTo 0
If myLastRow * myLastCol = 0 Then
.Columns.Delete
Else
.Range(.Cells(myLastRow + 1, 1), _
.Cells(.Rows.Count, 1)).EntireRow.Delete
.Range(.Cells(1, myLastCol + 1), _
.Cells(1, .Columns.Count)).EntireColumn.Delete
End If
End With
Next wks
End Sub
'--------->>
Sub TestForMergedCells()
Dim AnyMerged As Variant
AnyMerged = ActiveSheet.UsedRange.MergeCells
If AnyMerged = False Then
MsgBox "no merged"
ElseIf AnyMerged = True Then
MsgBox "all merged"
ElseIf IsNull(AnyMerged) Then
MsgBox "mixture"
Else
MsgBox "never gets here--only 3 options"
End If
End Sub
'<<=========
- Alt+Q per chiudere l'editor di VBA e tornare a Excel
- Alt+F8 per aprire la finestra di gestione delle macro
- Seleziona DeleteUnused | Esegui
===
Regards,
Norman