#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 23
Default Delete rows

Hello,

From cell A1 to A3500, I have many cells with infos in it and many cells
with no info at all. How can I create a macro that will delete the entire
row in which colomn A has no info???

In example:

A1: Test 1
A2:
A3:
A4:
A5: Test 2
A6:
A7: Test 3
A8:

I would like to create a macro that will automatically delete rows 2-3-4-6-8
and leave intact rows 1-5-7.

Thanks!!!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 64
Default Delete rows

Try this -- it works well for me:

Private Sub DeleteBlankRows()

Dim lastrow As Long
Dim r As Long
lastrow = Range("C" & Rows.Count).End(xlUp).Row
For r = lastrow To 2 Step -1
If Application.CountIf(Cells(r, "C").Resize(1, 1), 0) = 1 Then
ActiveSheet.Rows(r).Delete
End If
Next

End Sub

HTH
"One-Leg" wrote in message
...
Hello,

From cell A1 to A3500, I have many cells with infos in it and many cells
with no info at all. How can I create a macro that will delete the entire
row in which colomn A has no info???

In example:

A1: Test 1
A2:
A3:
A4:
A5: Test 2
A6:
A7: Test 3
A8:

I would like to create a macro that will automatically delete rows
2-3-4-6-8
and leave intact rows 1-5-7.

Thanks!!!



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Delete rows

Sub DeleteRowsWithBlanks()
Range("A:A").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
End Sub

HTH,
Bernie
MS Excel MVP


"One-Leg" wrote in message
...
Hello,

From cell A1 to A3500, I have many cells with infos in it and many cells
with no info at all. How can I create a macro that will delete the entire
row in which colomn A has no info???

In example:

A1: Test 1
A2:
A3:
A4:
A5: Test 2
A6:
A7: Test 3
A8:

I would like to create a macro that will automatically delete rows 2-3-4-6-8
and leave intact rows 1-5-7.

Thanks!!!



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 64
Default Delete rows

Your "modified code" will look like this:

Private Sub DeleteBlankRows()

Dim lastrow As Long
Dim r As Long
lastrow = Range("A" & Rows.Count).End(xlUp).Row
For r = lastrow To 2 Step -1
If Application.CountIf(Cells(r, "A").Resize(1, 1), "") = 1 Then
ActiveSheet.Rows(r).Delete
End If
Next

End Sub
:)
"One-Leg" wrote in message
...
Hello,

From cell A1 to A3500, I have many cells with infos in it and many cells
with no info at all. How can I create a macro that will delete the entire
row in which colomn A has no info???

In example:

A1: Test 1
A2:
A3:
A4:
A5: Test 2
A6:
A7: Test 3
A8:

I would like to create a macro that will automatically delete rows
2-3-4-6-8
and leave intact rows 1-5-7.

Thanks!!!



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 64
Default Delete rows

Bernie,

I like your code better -- quick and to-the-point! ;)

"Bernie Deitrick" <deitbe @ consumer dot org wrote in message
...
Sub DeleteRowsWithBlanks()
Range("A:A").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
End Sub

HTH,
Bernie
MS Excel MVP


"One-Leg" wrote in message
...
Hello,

From cell A1 to A3500, I have many cells with infos in it and many cells
with no info at all. How can I create a macro that will delete the
entire
row in which colomn A has no info???

In example:

A1: Test 1
A2:
A3:
A4:
A5: Test 2
A6:
A7: Test 3
A8:

I would like to create a macro that will automatically delete rows
2-3-4-6-8
and leave intact rows 1-5-7.

Thanks!!!







  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Delete rows

You have been given a choice of macros, but could do the job manually.

Select column A and F5SpecialBlanksOK

EditDeleteEntire row.


Gord Dibben MS Excel MVP

On Fri, 8 Dec 2006 08:41:00 -0800, One-Leg
wrote:

Hello,

From cell A1 to A3500, I have many cells with infos in it and many cells
with no info at all. How can I create a macro that will delete the entire
row in which colomn A has no info???

In example:

A1: Test 1
A2:
A3:
A4:
A5: Test 2
A6:
A7: Test 3
A8:

I would like to create a macro that will automatically delete rows 2-3-4-6-8
and leave intact rows 1-5-7.

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
easy way to delete all rows with no text in them? george edgar New Users to Excel 2 May 13th 06 07:54 PM
delete rows Jack Sons Excel Discussion (Misc queries) 5 November 22nd 05 04:30 PM
Delete Rows where cells does not meet criteria Danny Excel Worksheet Functions 1 September 12th 05 05:08 PM
Want to delete rows Farooq Sheri Excel Discussion (Misc queries) 6 September 12th 05 12:46 PM
How can we delete rows permanently from excel sheet Nehal Shah Excel Discussion (Misc queries) 1 August 1st 05 01:58 PM


All times are GMT +1. The time now is 05:20 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"