Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
DELETING LINES THAT ARE THE SAME IN A TABLE | Excel Discussion (Misc queries) | |||
Macro not recognizing blank lines as blank | Excel Discussion (Misc queries) | |||
MACRO HELP - deleting rows containing a range of blank cells | Excel Discussion (Misc queries) | |||
Deleting unused lines between used lines? | Setting up and Configuration of Excel | |||
Hiding Blank lines in named range | Excel Programming |