ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to delete blank rows in a worksheet (https://www.excelbanter.com/excel-programming/425862-macro-delete-blank-rows-worksheet.html)

adchris

Macro to delete blank rows in a worksheet
 
I am attempting to create a macro that will eliminate blank rows from a tab
in a worksheet. I need to do this in order to maintain the "auto-complete"
functionality.

Mike H

Macro to delete blank rows in a worksheet
 
Hi,

Right click your sheet tab, view code and paste this in and run it

Sub Sonic()
Dim i As Long
With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For i = lastrow To 1 Step -1
If WorksheetFunction.CountA(Rows(i)) = 0 Then
Rows(i).EntireRow.Delete
End If
Next i
.Calculation = xlCalculationAutomatic
.ScreenUpdating = True
End With
End Sub

Mike

"adchris" wrote:

I am attempting to create a macro that will eliminate blank rows from a tab
in a worksheet. I need to do this in order to maintain the "auto-complete"
functionality.


Gord Dibben

Macro to delete blank rows in a worksheet
 
Do you need a macro?

Select a column with the blank rows and F5SpecialBlanksOK

EditDeleteEntire Row.


Gord Dibben MS Excel MVP

On Fri, 20 Mar 2009 13:44:01 -0700, adchris
wrote:

I am attempting to create a macro that will eliminate blank rows from a tab
in a worksheet. I need to do this in order to maintain the "auto-complete"
functionality.




All times are GMT +1. The time now is 06:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com