ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro to delete rows (https://www.excelbanter.com/excel-programming/427253-re-macro-delete-rows.html)

Gary''s Student

macro to delete rows
 
Sub macro_der()
Dim i As Long, nLastRow As Long
Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.Count + r.Row - 1
Set r = Rows(nLastRow + 1)
For i = 1 To nLastRow
If Application.CountA(Rows(i)) = 0 Then
Set r = Union(r, Rows(i))
End If
Next
r.Delete
End Sub

--
Gary''s Student - gsnu200847


"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:37 PM.

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