ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   formula to remove blank rows (https://www.excelbanter.com/excel-discussion-misc-queries/67302-formula-remove-blank-rows.html)

Bryan

formula to remove blank rows
 
is there a formula to remove all blank rows in a sheet all at once

Gary''s Student

formula to remove blank rows
 
Try this macro:


Sub Macro1()
Dim j As Long
Dim i As Long
Dim r As Range

j = 65536
For i = 1 To j
If Application.CountA(Rows(i)) = 0 Then
If r Is Nothing Then
Set r = Rows(i)
Else
Set r = Union(r, Rows(i))
End If
End If
Next i

If Not r Is Nothing Then
r.Delete
End If
End Sub
--
Gary's Student


"Bryan" wrote:

is there a formula to remove all blank rows in a sheet all at once



All times are GMT +1. The time now is 08:51 PM.

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