Deleting Blank Cells

damian

New Member
Joined
Apr 21, 2002
Messages
1
I have a list of cells which I want to run a regression on. However, some of the data is missing, so I cannot run the regression. Is there a way for me to get excel to delete the blank cells.

Example:

Point Age Wage
1 10 12
2 30 40
3 28
4 50 49

So in this case, I would want to delete the entire 3rd row. I have 50,000 data points so I do no want to do it all manually.

Thanks!
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi Damian,

Try,

'---begin VBA---
Sub delete_rows()

Dim lastrow As Long
Dim rng As Range

Application.ScreenUpdating = False
Rows(1).Insert
Range("C1") = "temp"

With ActiveSheet
.UsedRange
lastrow = .Cells.SpecialCells(xlCellTypeLastCell).Row
Set rng = Range("C1", Cells(lastrow, "C"))
rng.AutoFilter Field:=1, Criteria1:=""
rng.SpecialCells(xlCellTypeVisible).EntireRow.Delete
.UsedRange
End With

End Sub
'---end VBA---
 
Upvote 0

Forum statistics

Threads
1,214,938
Messages
6,122,346
Members
449,080
Latest member
Armadillos

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