By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,720 Members | 1,155 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,720 IT Pros & Developers. It's quick & easy.

How to remove Rows with blank data

P: 1
Hi, i've searched through the discussions but haven't got a clue to solve my problem. Im new to VBA, maybe its a simple task but any help is welcomed.

The Problem:

Every month, I need to sort data in an excel sheet where each set of data is submitted in 3 rows. In these rows, some cells are merged and some are not. As such, i get empty blank rows in between. My aim is to remove all these blanks by deleting the whole row. Data in merge cells seem to automatically jump to the row containing other data.

I created a code like this:

Sub DeleteNullRows()

Dim x As Integer
Dim Contents1 As String
Dim Contents2 As String

x = 3

NextRow:
Contents1 = Cells(x, 1)
Contents2 = Cells(x, 2)
If IsNull(Contents1) = True Then
rows(x).Delete
x = x
If IsNull(Contents1) = False Then
x = x + 1
End If
Contents1 = ""
Contents2 = ""
GoTo NextRow
End If

End Sub


But its not working at all :/

I also have problem ending this
Jan 23 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.