Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to remove empty rows

I have data in columns A, B and C, that goes down to
3,200 rows. I would like any row without any data to be
deleted and the row below it moved up in its place.
Thanks for any help,

Tammy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro to remove empty rows

Hi Tammy

Try this one for the activesheet
Row 1 -100


Sub Example2()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = 100
For Lrow = EndRow To StartRow Step -1
If Application.CountA(Range(.Cells(Lrow, "A"), _
.Cells(Lrow, "C"))) = 0 Then .Rows(Lrow).Delete
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Tammy" wrote in message ...
I have data in columns A, B and C, that goes down to
3,200 rows. I would like any row without any data to be
deleted and the row below it moved up in its place.
Thanks for any help,

Tammy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Macro to remove empty rows

Wow. That's a lot of code for such a simple thing. I asked this question a
couple of days ago and good person answered my question with simple one or
two line code.

See the message "deleting blank rows" on August 2nd

"Ron de Bruin" wrote in message
...
Hi Tammy

Try this one for the activesheet
Row 1 -100


Sub Example2()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = 100
For Lrow = EndRow To StartRow Step -1
If Application.CountA(Range(.Cells(Lrow, "A"), _
.Cells(Lrow, "C"))) = 0 Then .Rows(Lrow).Delete
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Tammy" wrote in message

...
I have data in columns A, B and C, that goes down to
3,200 rows. I would like any row without any data to be
deleted and the row below it moved up in its place.
Thanks for any help,

Tammy





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro to remove empty rows

Hi Ryan

Read good
Data in column A:C

If you want to check one column the you can do it with a few lines

You mean this one from that thread

Sub Delete_blank_Rows()
'Will delete the whole row where there are blank cells in A1:A50
[A1:A50].SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub

Better change it to

Sub Delete_blank_Rows2()
On Error Resume Next
[A1:A50].SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0
End Sub

Because if there are no blank cells it will give a error

A other possible problem with this one is
There is a limit with Specialcells
http://support.microsoft.com/default...b;en-us;832293

David have a example om his site for you
http://www.mvps.org/dmcritchie/excel/delempty.htm

The sub is named del_COLA_empty()

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ryan H." wrote in message t.cable.rogers.com...
Wow. That's a lot of code for such a simple thing. I asked this question a
couple of days ago and good person answered my question with simple one or
two line code.

See the message "deleting blank rows" on August 2nd

"Ron de Bruin" wrote in message
...
Hi Tammy

Try this one for the activesheet
Row 1 -100


Sub Example2()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = 100
For Lrow = EndRow To StartRow Step -1
If Application.CountA(Range(.Cells(Lrow, "A"), _
.Cells(Lrow, "C"))) = 0 Then .Rows(Lrow).Delete
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Tammy" wrote in message

...
I have data in columns A, B and C, that goes down to
3,200 rows. I would like any row without any data to be
deleted and the row below it moved up in its place.
Thanks for any help,

Tammy







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to remove empty rows

Thanks Ron and Ryan!

-----Original Message-----
Hi Ryan

Read good
Data in column A:C

If you want to check one column the you can do it with a

few lines

You mean this one from that thread

Sub Delete_blank_Rows()
'Will delete the whole row where there are blank cells

in A1:A50
[A1:A50].SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub

Better change it to

Sub Delete_blank_Rows2()
On Error Resume Next
[A1:A50].SpecialCells(xlCellTypeBlanks).EntireRow.Delete
On Error GoTo 0
End Sub

Because if there are no blank cells it will give a error

A other possible problem with this one is
There is a limit with Specialcells
http://support.microsoft.com/default.aspx?scid=kb;en-

us;832293

David have a example om his site for you
http://www.mvps.org/dmcritchie/excel/delempty.htm

The sub is named del_COLA_empty()

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ryan H." wrote in message

news:dcbQc.1433978
...
Wow. That's a lot of code for such a simple thing. I

asked this question a
couple of days ago and good person answered my

question with simple one or
two line code.

See the message "deleting blank rows" on August 2nd

"Ron de Bruin" wrote in

message
...
Hi Tammy

Try this one for the activesheet
Row 1 -100


Sub Example2()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = 100
For Lrow = EndRow To StartRow Step -1
If Application.CountA(Range(.Cells

(Lrow, "A"), _
.Cells(Lrow, "C"))) = 0 Then .Rows

(Lrow).Delete
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Tammy" wrote

in message
...
I have data in columns A, B and C, that goes down

to
3,200 rows. I would like any row without any data

to be
deleted and the row below it moved up in its place.
Thanks for any help,

Tammy






.

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
How do I remove 10,000+ empty rows below my table? Frustrated Excel User[_2_] Excel Discussion (Misc queries) 8 April 14th 23 05:34 PM
how to remove empty rows? Joe Excel Discussion (Misc queries) 2 January 6th 08 05:10 PM
How do I remove empty Rows Rodders Excel Discussion (Misc queries) 2 January 12th 07 12:04 PM
remove all blank or empty rows [email protected] [email protected] Excel Programming 8 January 18th 04 07:55 PM
Remove empty rows Kaj Pedersen Excel Programming 15 November 2nd 03 07:22 PM


All times are GMT +1. The time now is 02:58 PM.

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

About Us

"It's about Microsoft Excel"