Results 1 to 20 of 37

Thread: Solved: Deleting blank rows in range? a better way?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,476
    Location
    Hi Simon,
    I'll go with XLD here, and the best way to include 0 is to find and clear them first.
    [vba]
    Sub removeblanks()
    Dim Rng As Range
    Dim MyCell
    Dim i
    Set Rng = Range("C9:C119")
    With Rng
    Set C = .Find(0, LookIn:=xlValues, LookAt:=xlWhole)
    If Not c Is Nothing Then
    Do
    c.ClearContents
    Set c = .FindNext(c)
    Loop While Not c Is Nothing
    End If
    Rng.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    End With
    End Sub

    [/vba]
    Last edited by mdmackillop; 11-18-2006 at 07:12 AM. Reason: Find line amended
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •