+ Reply to Thread
Results 1 to 4 of 4

Blank lines

  1. #1
    Frank via OfficeKB.com
    Guest

    Blank lines

    I need to be able to delete blank lines in a macro, and the only VBA code I
    can find doesn't work if there's a formula in the cell, even if the value is
    zero. I tried copying and pasting special (Values), but even though the
    formula isn't there any more, it still won't delete that line. I would
    appreciate any suggestions.

    --
    Message posted via http://www.officekb.com

  2. #2
    Ron de Bruin
    Guest

    Re: Blank lines

    Hi Frank

    Do you check one column ?

    Here is a example for the A column (row 1 -100)

    Sub Example2()
    Dim Lrow As Long
    Dim CalcMode As Long
    Dim StartRow As Long
    Dim EndRow As Long
    With Application
    CalcMode = .Calculation
    .Calculation = xlCalculationManual
    .ScreenUpdating = False
    End With

    With ActiveSheet
    .DisplayPageBreaks = False
    StartRow = 1
    EndRow = 100
    For Lrow = EndRow To StartRow Step -1
    If IsError(.Cells(Lrow, "A").Value) Then
    'Do nothing, This avoid a error if there is a error in the cell

    ElseIf .Cells(Lrow, "A").Value = "" Then .Rows(Lrow).Delete

    End If
    Next
    End With
    With Application
    .ScreenUpdating = True
    .Calculation = CalcMode
    End With
    End Sub


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl


    "Frank via OfficeKB.com" <[email protected]> wrote in message news:[email protected]...
    >I need to be able to delete blank lines in a macro, and the only VBA code I
    > can find doesn't work if there's a formula in the cell, even if the value is
    > zero. I tried copying and pasting special (Values), but even though the
    > formula isn't there any more, it still won't delete that line. I would
    > appreciate any suggestions.
    >
    > --
    > Message posted via http://www.officekb.com




  3. #3
    Bob Phillips
    Guest

    Re: Blank lines


    "Frank via OfficeKB.com" <[email protected]> wrote in message
    news:[email protected]...
    > I need to be able to delete blank lines in a macro, and the only VBA code

    I
    > can find doesn't work if there's a formula in the cell, even if the value

    is
    > zero.


    Why not? Paste your c ode.




  4. #4
    Frank via OfficeKB.com
    Guest

    Re: Blank lines

    WOW! That was great! Thank you so very much. I have tried and tried to make
    this work. I'd buy you lunch if you were here.

    --
    Message posted via http://www.officekb.com

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1