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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove Excel lines with an empty cell

Status
Not open for further replies.

gc6294

IS-IT--Management
Feb 23, 2004
56
US
Is there a way to execute a script that would remove all rows in an Excel spreadsheet if a certain cell on that row is empty. For example, would like to automatically remove all rows where cell H in that row has no value. Is that easy to do? Thanks
 
You could use the Sort option in Excel to sort by the row you want to check for blanks. That would put all the blank rows together then you could quickly select and delete them.

Just select the range of data you want then go to

Data > Sort

Choose the column you want to sort by and leave it as Ascending. That should bring your blanks to the top.
 
Thanks - I was hoping for something a little less manual, but, yes you are correct, that would work.. Thanks
 
You could use the Data Filter command to manipulate your data too.



Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
For future reference, VBA/Macro-specific questions should be posted in forum707.

But, to answer your question, this will do it with a single line of code:
Code:
columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete


[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top