+ Reply to Thread
Results 1 to 3 of 3

How do I delete a row in excel if it has no value?

  1. #1
    CarSum
    Guest

    How do I delete a row in excel if it has no value?

    I work a lot in spreadsheets that are linked together. Eg I enter data on
    one sheet it is recalculated and placed on another spreadsheet that has
    multiple rows of data on it. I then delete the lines that have no data from
    previous sheet on it to print a neater form. Can I somehow get these rows
    that have a zero valu in a certain column not show up when I print instead of
    manually deleting them one by one.
    Thank You for any help you may be able to give me.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523
    insert this code in a module
    you can make a button and assign the macro to the button
    when you highlite a range, run the macro and it will delete the empty rows


    Sub DeleteBlankRows1()
    'Deletes the entire row within the selection if the ENTIRE row contains no data.

    'We use Long in case they have over 32,767 rows selected.
    Dim i As Long

    'We turn off calculation and screenupdating to speed up the macro.
    With Application
    .Calculation = xlCalculationManual
    .ScreenUpdating = False

    'We work backwards because we are deleting rows.
    For i = Selection.Rows.Count To 1 Step -1
    If WorksheetFunction.CountA(Selection.Rows(i)) = 0 Then
    Selection.Rows(i).EntireRow.Delete
    End If
    Next i

    .Calculation = xlCalculationAutomatic
    .ScreenUpdating = True
    End With
    End Sub

  3. #3
    bj
    Guest

    RE: How do I delete a row in excel if it has no value?

    This sounds like a good place for using auto filter
    select a column which would be blank for the rows you would not want to show
    when printing.
    Select non blank from the auto filter options.

    "CarSum" wrote:

    > I work a lot in spreadsheets that are linked together. Eg I enter data on
    > one sheet it is recalculated and placed on another spreadsheet that has
    > multiple rows of data on it. I then delete the lines that have no data from
    > previous sheet on it to print a neater form. Can I somehow get these rows
    > that have a zero valu in a certain column not show up when I print instead of
    > manually deleting them one by one.
    > Thank You for any help you may be able to give me.


+ 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