VBA Delete a row in active sheet Please help

  • Thread starter Thread starter Alexandre
  • Start date Start date
A

Alexandre

As you can see below i am grabbing all the used cells
and i want to delete each row where column Y = "Page:"

but i get type mismatches ...

can someone refer me to references or spin me to the right direction.

Thank you.

=============================================

Sub DeletePageHeaderRows(DeleteRange As Range)
' Deletes all empty rows in DeleteRange
' Example: DeleteEmptyRows Selection
' Example: DeleteEmptyRows Range("A1:D100")
Dim rCount As Long, r As Long
If DeleteRange Is Nothing Then Exit Sub
If DeleteRange.Areas.Count > 1 Then Exit Sub
With DeleteRange
rCount = .Rows.Count
For r = rCount To 1 Step -1

If DeleteRange.Cells(.Rows(r), 25).Value <> Null Then
If DeleteRange.Cells(.Rows(r), 25).Value = "Page:" Then
.Rows(r).EntireRow.Delete
End If
End If

Next r
End With
End Sub
 
Thanks Ron,

I will bookmark your site,
Im also very happy of the fast responce,

have a good day.
 
Back
Top