Delete blank cells and corresponding dates

excelV

New Member
Joined
Mar 19, 2011
Messages
8
I have a bunch of columns with data with corresponding dates. The problem is that I have some invalid (#value!) and need to get rid of those. I have tried replacing the invalid cells with blanks but I still can't delete them. I have about 800 of these so I have been trying to create a macro that can do this in one shot.


Date Liquidity Date Liquidity
11/29/2007 0.057586008 7/30/2002 0.097560976
11/30/2007 0.059781879 8/1/2002 0.142857143
12/4/2007 0.057720572 8/2/2002 #VALUE!
12/5/2007 0.05913211 8/6/2002 0.077803204
12/6/2007 0.058447471 8/7/2002 0.098765432
 

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
Copy Paste to your VB Editor:

Sub delinvalid()
Dim i As Integer
Dim lrow As Integer


Range("a1").Select
lrow = Selection.End(xlDown).Row

For i = lrow To 1 Step -1
If IsError(Cells(i, "A").Value) Then Cells(i, "a").EntireRow.Delete

Next i


End Sub


Change cell A1 with the range that suits you

George

I have a bunch of columns with data with corresponding dates. The problem is that I have some invalid (#value!) and need to get rid of those. I have tried replacing the invalid cells with blanks but I still can't delete them. I have about 800 of these so I have been trying to create a macro that can do this in one shot.


Date Liquidity Date Liquidity
11/29/2007 0.057586008 7/30/2002 0.097560976
11/30/2007 0.059781879 8/1/2002 0.142857143
12/4/2007 0.057720572 8/2/2002 #VALUE!
12/5/2007 0.05913211 8/6/2002 0.077803204
12/6/2007 0.058447471 8/7/2002 0.098765432
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,875
Members
452,949
Latest member
Dupuhini

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