×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Referencing Rows to delete blank Rows

Referencing Rows to delete blank Rows

Referencing Rows to delete blank Rows

(OP)
I want to delete blanks row in a file that I am reading in so I check for blank cells.  I then try to slect the row by the row number. this is where it hangs up.

CURRENT_ROW = 7
Rows("CURRENT_ROW:CURRENT_ROW").Select      <= hangs up

because I know that

Rows("7:7").select

works

any help would be great thanks



RE: Referencing Rows to delete blank Rows

Hello,

Try this line

rows(current_rows).delete

Hope this helps!

maybe only a drafter
but the best user at this company!

RE: Referencing Rows to delete blank Rows

You can also try this to delete all the empty rows in the used portion of a spreadsheet.  

Sub DeleteEmptyRows()
    LastRow = ActiveSheet.UsedRange.column - 1 + ActiveSheet.UsedRange.Rows.Count
    For r = LastRow To 1 Step -1
        If Application.CountA(Rows(r)) = 0 Then Rows(r).Delete
    Next R
End Sub

RE: Referencing Rows to delete blank Rows

Hello,

I'm just looking back over my threads for filing purposes and just found a better way to do this. I know it's a couple of months later but someone may find this useful.

Sub Macro1()
Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub

Hope this helps.

----------------------------------

maybe only a drafter
but the best user at this company!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources