Deleting multiple rows in Excel

natasha_tracy

New Member
Joined
Aug 20, 2007
Messages
49
Hello All,

I have searched the forum already for this problem, but as far as I can see none of the threads related are quite what I'm looking for.

I have a spreadsheet with thousands of rows of data- some rows throughout the sheet are completely blank. Is there a way I can select all the blank rows and delete them without going through and selecting each row? I have tried sorting the data so that all the blank rows go to the end, but I need the data to stay in the order I imported it in, which cannot be sorted back in excel.

If anyone can help - it would be much appreciated.

Natasha
 

Some videos you may like

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

ADAMC

Well-known Member
Joined
Mar 20, 2007
Messages
1,166
edit

Hi welcome to the board,

Try selecting your column which contains data and running this code placed in the sheet module

Code:
Sub DeleteRowOnCell()
On Error Resume Next
Selection.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
ActiveSheet.UsedRange
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,122,694
Messages
5,597,571
Members
414,157
Latest member
MrBJBones

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
Top