G
Guest
I am currently using the following code to delete rows in which the specified
columns contain values of 0.
The reason I am writing this macro is because I have a rather massive, and
computation heavy, worksheet that will benefit from being parsed before
saving. The sheet itself is 265 x 2160 and about 21meg.
Anyone have suggestions on how I code execute this deletion without crashing
a computer (personally running a 1.5ghz 512meg Ram system)
Sub Project_Data_Deletion()
'Delete all unused cells from the Plan worksheet
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
Sheets("plan").Select
Range("c4:c2163").Select
For i = Selection.Cells.Count To 1 Step -1
If Selection.Cells(i) = 0 Then
Selection.Rows(i).EntireRow.Delete
End If
Next i
Range("f4:f2163").Select
For i = Selection.Cells.Count To 1 Step -1
If Selection.Cells(i) = 0 Then
Selection.Rows(i).EntireRow.Delete
End If
Next i
Range("m4:m2163").Select
For i = Selection.Cells.Count To 1 Step -1
If Selection.Cells(i) = 0 Then
Selection.Rows(i).EntireRow.Delete
End If
Next i
.ScreenUpdating = True
End Sub
columns contain values of 0.
The reason I am writing this macro is because I have a rather massive, and
computation heavy, worksheet that will benefit from being parsed before
saving. The sheet itself is 265 x 2160 and about 21meg.
Anyone have suggestions on how I code execute this deletion without crashing
a computer (personally running a 1.5ghz 512meg Ram system)
Sub Project_Data_Deletion()
'Delete all unused cells from the Plan worksheet
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
Sheets("plan").Select
Range("c4:c2163").Select
For i = Selection.Cells.Count To 1 Step -1
If Selection.Cells(i) = 0 Then
Selection.Rows(i).EntireRow.Delete
End If
Next i
Range("f4:f2163").Select
For i = Selection.Cells.Count To 1 Step -1
If Selection.Cells(i) = 0 Then
Selection.Rows(i).EntireRow.Delete
End If
Next i
Range("m4:m2163").Select
For i = Selection.Cells.Count To 1 Step -1
If Selection.Cells(i) = 0 Then
Selection.Rows(i).EntireRow.Delete
End If
Next i
.ScreenUpdating = True
End Sub