Deleting rows in Excel

Anonymous
2018-07-20T20:01:43+00:00

Is there anyway to have Excel 2007 delete rows with certain parameters? Here is what I am trying to do:

I have an auto generated Excel .cvs file, which another program generates. But I need certain rows deleted and there are a lot of them scattered throughout the file. What I would like to be able to do is if one column is empty (i.e. no data in that column), I would like Excel to completely delete that whole row...all data in that row, in all the columns, all the way across, for that particular row. Right now, I am doing this manually and it takes forever.

Suggestions appreciated!

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

9 answers

Sort by: Most helpful
  1. Anonymous
    2018-07-20T23:11:07+00:00

    You could use a macro stored in an Excel workbook. . . .you can't store macros in a CSV file.

    You would have both files open with CSV file active then run the macro from the VB Editor or a button on the QAT

    Will delete all rows in the CSV file in the selected column.

    Public Sub DeleteRowOnCell()

    'delete any row that has a blank in selected column(s)

    'select column header, not just a cell

       Set coltocheck = Application.InputBox(prompt:= _

                "Select A Column", Type:=8)

            On Error Resume Next

        coltocheck.SpecialCells(xlCellTypeBlanks).entirerow.Delete

    End Sub

    Gord

    0 comments No comments
  2. Anonymous
    2018-07-20T23:24:07+00:00

    If there is a hard way to do something, I'll find it<g>

    Forget the other post.

    How about selecting the desired column then F5>Special>Blanks>OK

    Edit>Delete>Entire Row.

    Gord

    0 comments No comments
  3. Anonymous
    2018-07-21T03:31:13+00:00

    If there is a hard way to do something, I'll find it<g>

    Forget the other post.

    How about selecting the desired column then F5>Special>Blanks>OK

    Edit>Delete>Entire Row.

    Gord

    OK, tried that. Couldn't find the "Edit" menu so did it from the right clicking and then selecting delete "entire row". That only deletes one row at a time...correct? Or at least it did for me. I was already deleting one at a time. Was looking for a way to to "all" of the rows that have that one cell blank, in one shot.

    0 comments No comments
  4. Anonymous
    2018-07-21T14:49:36+00:00

    Sorry about that.  Instructions from Excel 2003.

    In 2007, after you F5>Special>Blanks>OK, click on dropdown arrow of Delete and choose Delete Sheet Rows.

    Gord

    0 comments No comments
  5. Anonymous
    2018-07-23T13:28:21+00:00

    Thanks for the suggestion. I finally figured that part out...LOL! But, that only deletes a single row at a time...correct? Which is what I was already doing. I need a way to "mass" delete all those rows with blanks. Do that make sense?

    0 comments No comments