Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

deleting blanks cells rows

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Deleting blanks cells in rows of data

Deleting blanks cells in rows of data

ResolvedVersion 2007

Soo has attended:
Excel Advanced course
Excel Advanced course
Excel VBA Intro Intermediate course

Deleting blanks cells in rows of data

We tried doing this in the class. I couldn't do this when there are more than one rows of blanks one after another. Could you please send/email me the solution to this class exercise? Thank you.

RE: Deleting blanks cells in rows of data

Hi Soo,

Thank you for your question.

The code below will delete the rows that are blank using columns a:h which is the first and last column on the sheet I used to write and test it.

Please try this code below:

Public Sub DeleteAllBlankRows()
Dim WRBK As Workbook
Dim SHT As Worksheet

Set WRBK = ActiveWorkbook
Set SHT = WRBK.Sheets("TEAMBASE")
SHT.Columns("A:H").SpecialCells(xlBlanks).EntireRow.Delete


End Sub

I hope this helps.

Regards

Simon

Wed 6 Apr 2011: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Add a € to your cells

If you need to add a € symbol to your Excel sheet - hold down the key Alt Gr and 4.

Alt Gr is located on the right side of the space bar.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.