Delete Row in VBA

Ignition1

New Member
Joined
Feb 22, 2011
Messages
49
What is the code I need to delete a row if that row contains a value in Column W which is other than "Live"?

So I tried -

If Columns("W").Value = "Dormant" Then EntireRow.Delete

Which is clearly wrong. I had a look on the net but it didn't help. Bit stumped on this one.

Edit - I should point out that "Dormant" is one of about 5 values which isn't "Live"
 
You are telling it to delete anything greater than 1/12/2012 =0.00004 approx.

Try

Code:
If Range("Z" & i).Value > DateValue("1/12/2012") Then Rows(i).Delete
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
In between posting and reading the answers I made a macro to convert dates into number, delete, then convert them back again.

No idea why I forgot to use DateValue.

I think I'm burnt out.

Thanks everyone.
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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