![]() |
macro to delete rows
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 "AsquareDC" wrote: Can someone be kind enough to help me on how to create a macro that will delete blank rows from my worksheet that has data up to row 60,000. |
macro to delete rows
On reflection try this instead
Sub Sonic() Dim i As Long With Application .Calculation = xlCalculationManual .ScreenUpdating = False lastrow = ActiveSheet.UsedRange.Rows.Count 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 "Mike H" wrote: 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 "AsquareDC" wrote: Can someone be kind enough to help me on how to create a macro that will delete blank rows from my worksheet that has data up to row 60,000. |
All times are GMT +1. The time now is 05:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com