Deleting blank lines in a range
It that doesn't work, try this one:
should work with =""
Sub DeleteRows()
Dim lastrow As Long
Dim i As Long
lastrow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.R ows.Count).Row
colcnt = ActiveSheet.UsedRange.Columns.Count
For i = lastrow To 1 Step -1
If Application.CountBlank(Rows(i)) = 256 Then
Rows(i).Delete
End If
Next
End Sub
--
Regards,
Tom Ogilvy
"Tom Ogilvy" wrote in message
...
Sub DeleteRows()
Dim lastrow As Long
Dim i As Long
lastrow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.R ows.Count).Row
For i = lastrow To 1 Step -1
If Application.CountA(Rows(i)) = 0 Then
Rows(i).Delete
End If
Next
End Sub
--
Regards,
Tom Ogilvy
"Fred Taylor" wrote in message
...
Yes, I mean blank. =""
I have a table and want to delele all lines (lines and not only cell)
that
have no info.
"Alan Beban" wrote in message
...
You should define what you mean by "empty". Do you mean blanks? Empty
strings (i.e., ="")? Cells with only spaces? Etc.
Alan Beban
Fred Taylor wrote:
Hello,
I'm, trying to find a function/ or write a macro that will delete
ALL
empty
lines in a range.
Does anybody have any idea how I could do this?
Thanks
|