PC Review


Reply
Thread Tools Rate Thread

Delete empty rows in list of data

 
 
=?Utf-8?B?c3N3Y2hhcmxpZTE=?=
Guest
Posts: n/a
 
      7th Jan 2007
I want to delete empty rows in a data list by macro.

Which is the simplest method of doing this


--
Charlie New XP User
 
Reply With Quote
 
 
 
 
Rod Gill
Guest
Posts: n/a
 
      7th Jan 2007
One way is to sort the list. Empty rows end up at the top or bottom
depending on which way you sort.

--

Rod Gill


"sswcharlie1" <(E-Mail Removed)> wrote in message
news:F3B60F96-A0C5-4C62-A843-(E-Mail Removed)...
>I want to delete empty rows in a data list by macro.
>
> Which is the simplest method of doing this
>
>
> --
> Charlie New XP User



 
Reply With Quote
 
=?Utf-8?B?c3N3Y2hhcmxpZTE=?=
Guest
Posts: n/a
 
      7th Jan 2007
Unfortunately the data is in groups and I would mix up the data that I want
to extract by a macro.

Charlie
--
Charlie New XP User


"Rod Gill" wrote:

> One way is to sort the list. Empty rows end up at the top or bottom
> depending on which way you sort.
>
> --
>
> Rod Gill
>
>
> "sswcharlie1" <(E-Mail Removed)> wrote in message
> news:F3B60F96-A0C5-4C62-A843-(E-Mail Removed)...
> >I want to delete empty rows in a data list by macro.
> >
> > Which is the simplest method of doing this
> >
> >
> > --
> > Charlie New XP User

>
>
>

 
Reply With Quote
 
Corey
Guest
Posts: n/a
 
      7th Jan 2007
Have a look here,
Think it may assist you:

http://www.ozgrid.com/VBA/VBACode.htm

Corey....
"sswcharlie1" <(E-Mail Removed)> wrote in message
news:F05E51AF-1B59-4504-8693-(E-Mail Removed)...
> Unfortunately the data is in groups and I would mix up the data that I
> want
> to extract by a macro.
>
> Charlie
> --
> Charlie New XP User
>
>
> "Rod Gill" wrote:
>
>> One way is to sort the list. Empty rows end up at the top or bottom
>> depending on which way you sort.
>>
>> --
>>
>> Rod Gill
>>
>>
>> "sswcharlie1" <(E-Mail Removed)> wrote in message
>> news:F3B60F96-A0C5-4C62-A843-(E-Mail Removed)...
>> >I want to delete empty rows in a data list by macro.
>> >
>> > Which is the simplest method of doing this
>> >
>> >
>> > --
>> > Charlie New XP User

>>
>>
>>



 
Reply With Quote
 
Nigel
Guest
Posts: n/a
 
      7th Jan 2007
The following uses column A to determine the depth of the data, and scan all
rows from the bottom to top, removing rows where every column in that row is
empty. If cells contain spaces then this will not work. So use version 2
below.

Sub exempty()
Dim xlr As Long, xr As Long
xlr = Cells(Rows.Count, 1).End(xlUp).Row
For xr = xlr To 1 Step -1
If Application.WorksheetFunction.CountA(Rows(xr)) = 0 Then
Rows(xr).EntireRow.Delete
Next xr
End Sub

' code if cells might contain spaces which should be ignored
Sub exempty2()
Dim xlr As Long, xr As Long, xlDelete As Boolean, xc As Integer
xlr = Cells(Rows.Count, 1).End(xlUp).Row
For xr = xlr To 1 Step -1
xlDelete = True
For xc = 1 To 256
If Len(Trim(Cells(xr, xc))) > 0 Then
xlDelete = False
Exit For
End If
Next xc
If xlDelete Then Rows(xr).EntireRow.Delete
Next xr
End Sub

--
Cheers
Nigel



"sswcharlie1" <(E-Mail Removed)> wrote in message
news:F3B60F96-A0C5-4C62-A843-(E-Mail Removed)...
>I want to delete empty rows in a data list by macro.
>
> Which is the simplest method of doing this
>
>
> --
> Charlie New XP User



 
Reply With Quote
 
=?Utf-8?B?TmV3Ymll?=
Guest
Posts: n/a
 
      7th Jan 2007


"sswcharlie1" wrote:

> I want to delete empty rows in a data list by macro.
> Sub cleanline()

Dim rg As Range, rgBlank As Range

Set rg = ActiveSheet.Range("A:A")

On Error Resume Next
Set rgBlank = rg.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0

If rgBlank Is Nothing Then 'no blank cell
MsgBox "No Blank cells found"
Else 'else delete entire rows
rgBlank.EntireRow.Delete
End If
End Sub
> Which is the simplest method of doing this
>
>
> --
> Charlie New XP User

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete rows with empty cells throughout the data rutski Microsoft Excel Worksheet Functions 4 16th Nov 2007 04:24 PM
Delete Rows with Empty Cells with empty column 1 Scott Microsoft Excel Programming 6 2nd Oct 2006 11:57 PM
Find last row of data and delete empty rows Pat Microsoft Excel Programming 3 17th Feb 2005 12:34 AM
how do i delete empty rows in a list of data =?Utf-8?B?R3VzdGF2byBDYXNjYW50ZQ==?= Microsoft Access External Data 2 28th Oct 2004 08:55 PM
How to detect and delete empty rows in a list? =?Utf-8?B?U3RlZmY=?= Microsoft Excel Programming 6 23rd Mar 2004 12:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:29 PM.