Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete

Status
Not open for further replies.

komark

Technical User
Sep 12, 2005
134
US
Hi,
I need help with a simple code. I want to delete the entire row if a cell in that row contains no value.
Can anyone help me?

 
A starting point:
If ActiveCell.Value = "" Then ActiveCell.EntireRow.Delete

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Code:
columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Replace A with whatever column you want to check against.

[tt]_____
[blue]-John[/blue][/tt]

Help us help you. Please read FAQ181-2886 before posting.
 
Thanks PHV..its working fine
 
anotherhiggins
With your code how can I delete the entire rows if any cell contains the null value under the column A and C?
 
What exactly is it that you are going for?

Do you want to only delete rows where both A and C are empty? or Where A or C are empty? If you want to delete rows where the entire row is empty, that can be done pretty easily. But before thinking on this, I just want to make sure I know what it is you're looking for.

[tt]_____
[blue]-John[/blue][/tt]

Help us help you. Please read FAQ181-2886 before posting.
 
I want to delete rows where both A and C are empty.
 
Use Autofilter or advanced filter if you need to test for conditions in more than a single column. Macro recorder will give you the code.

Thanks,

Gavin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top