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

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
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,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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