PDA

View Full Version : Solved: remove/delete empty rows



Pete
12-02-2009, 08:47 AM
need a macro to remove all empty rows using column B and run macro until last row in column B...

then...

find last row in column G with data in ti and remove/delete the next three rows

Pete
12-02-2009, 09:46 AM
the macro starting at b6 loop through and find all empty cells in column B and remove the empty rows until the last row containing data in column B - is missing a few rows in column B....

here is my go after 1 hour

Sub Edit_4()
Application.ScreenUpdating = False
Dim LastB As Long
LastB = [B65536].End(xlUp).Row
For i = LastB To 7 Step -1
Cells(i, "B").Select
If Selection.Value = "" Then
Selection.EntireRow.Delete
End If
Next i
Application.ScreenUpdating = True

End Sub

Bob Phillips
12-02-2009, 10:04 AM
Sub Edit_4()
Application.ScreenUpdating = False

Dim LastB As Long
Dim rng As Long

With ActiveSheet

LastB = .Cells(.Rows.Count, "B").End(xlUp).Row

On Error Resume Next
Set rng = .Range("B6").Resize(LastB).SpecialCells(xlCellTypeBlanks)
On Error GoTo 0

If Not rng Is Nothing Then rng.EntireRow.Delete
End With

Application.ScreenUpdating = True

End Sub

Pete
12-02-2009, 12:29 PM
thanks xld.......