EntireRowBlank? Just cant make it work....

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
Current code which does not work is as below:)

Please advice.
Thanks in advance.

Code:
[/FONT]
[FONT=Courier New]Option Explicit[/FONT]
[FONT=Courier New]Sub EntireRowBlank()
Dim lr As Long
Dim i As Range
lr = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
       
For Each i In Range("A1:A" & lr)
 If IsBlank(i.EntireRow) Then
  MsgBox "Yes"
 End If
Next i
End Sub
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Or this might be faster...

If Len(i) = 0 AND Cells(i.Row, Columns.Count).End(xlToLeft).Column = 1 Then
 
Upvote 0
Thank Jon,

it is working, however wont delete all the blank rows...so i tried different way with your code and still stuck....


Please check it again for me...
Code:
[/FONT]
[FONT=Courier New]Sub IreRowBlank()
Dim lr As Long
Dim i As Long
lr = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
       [/FONT]
[FONT=Courier New]For i = lr To 1 Step -1
 If Application.CountBlank(Cells(i, "A").EntireRow) = Columns.Count Then
  Cells(i, "A").EntireRow.Delete
 End If
Next i
End Sub
 
Upvote 0
Your code works fore me...

When you say it won't delete all the blank rows...
Does that mean it deletes SOME of them, or NONE at all?

This may suggest your blanks are not really blank...
 
Upvote 0
Hi Jon, sorry if i confused you...
I didnt say it didnt work...it is working perfectly and i'm using your line...
The thing is that....i am looping from top to bottom and thus it wont delete all the rows....because if row 1 is blank when deleted row 1 is 1 so it goes to row 2 without deleting row 1 which is originally row2

Thanks again...
Pedie
 
Upvote 0
Pedie

The last code you posted loops from bottom to top, which is what you should do.
 
Upvote 0
Norie, yes it is looping from bottom to top, however i dont know why it does not delete all the rows that are completely blank...

Thanks again guys!
 
Upvote 0
Norie, yes it is looping from bottom to top, however i dont know why it does not delete all the rows that are completely blank...

Thanks again guys!

OK, so I'll ask again...

When you say it won't delete all the blank rows...
Does that mean it deletes SOME of them, or NONE at all?

This may suggest your blanks are not really blank...
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

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
Back
Top