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!

macro to remove rows where first column is blank 2

Status
Not open for further replies.

collierd

MIS
Dec 19, 2001
509
DE
Hello

I am using MS Excel 2003

I have a number of spreadsheets that are anywhere between 1 and 100 rows in size

There are any number of blank(ish) rows
By that I mean the first cell (A) will always be blank if I want to remove it but other cells in the row may contain data

How can I create a macro that delete any rows whereby the first cell is blank?



Thanks

Damian.
 
Try the Macro Recorder. The easiest way to get what you want will be to select column A, then go to Edit > Goto then click on Special. Click beside Blanks, then OK. Now right click on any of the selected cells and choose Delete. Choose Entire row.

That's it. Now observe the code you've recorded.

You can shorten the result by getting rid of the .Select at the end of each line of code and the Selection at the beginning of the following line of code and combining them into a single line of code.

[tt]_____
[blue]-John[/blue]
[/tt][red]Quidquid latine dictum sit, altum viditur[/red]

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

Part and Inventory Search

Sponsor

Back
Top