Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Deleting blank lines in a range

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



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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









  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Deleting blank lines in a range

Just for the record, many believe that blank is best reserved for cells
that don't contain anything. Cells with ="" contain the empty string.
For example, after

Set rng = range("A1:A10")

IsEmpty(rng(i)), where i is an integer from 1 to 10, will return True
only for truly blank cells, not for those with ="" in them.

Similarly on the worksheet; =ISBLANK(A1) will return TRUE if the cell is
truly blank, FALSE if it contains =""

Alan Beban

Fred Taylor wrote:
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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DELETING LINES THAT ARE THE SAME IN A TABLE conditional format if cell contains word[_2_] Excel Discussion (Misc queries) 1 May 28th 09 03:04 AM
Macro not recognizing blank lines as blank pm Excel Discussion (Misc queries) 9 May 22nd 07 04:16 PM
MACRO HELP - deleting rows containing a range of blank cells DavidHawes Excel Discussion (Misc queries) 9 February 26th 07 03:40 PM
Deleting unused lines between used lines? Stevel Setting up and Configuration of Excel 1 November 25th 05 12:58 AM
Hiding Blank lines in named range Carl Brehm Excel Programming 3 August 8th 03 05:17 PM


All times are GMT +1. The time now is 03:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"