Out of memory when deleting rows

LabanDC

New Member
Joined
Oct 10, 2015
Messages
1
I try to run the VBA code below to delete all of the rows is the range row 12-100 what are empty in the C column.
Anyhow I get "out of memory" error when running this. Any idea about why?

For i = 100 To 12 Step -1

If Cells(i, 3) = "" Or Cells(i, 3) = "Name" Then
Range(Cells(i, 1), Cells(i, 2)).Select
Selection.Delete Shift:=xlUp
End If

Next i

Best
Laban
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
without seeing all the elements, what formulas are being adjusted on the sheet you are deleting from, are they all recalculating

are you turning off calculation and screen up dating

does it fail immediately or part way through

does it fail on the same line
 
Upvote 0
this is virtually instantaneous

Code:
Sub clean()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For i = 100 To 12 Step -1
If Cells(i, 3) = "" Or Cells(i, 3) = "Name" Then Range(Cells(i, 1), Cells(i, 2)).Delete
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,897
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top