Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete rows Macro | Excel Programming | |||
Using a Macro to delete all rows containing #N/A | Excel Programming | |||
Macro to delete rows | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming |