Delete rows based on contents of Col A

Joined
Jun 20, 2014
Messages
2
Reaction score
0
I have a formula, in the first 1,000 rows of column A, that evaluates to either a long text string or to "".

I discovered that the LEN() function evaluates to "1" when the text string argument is "" and wrote the following VBA code to take advantage of that fact to delete the rows with "" in column A. However, I am new to VBA and can't get it to work. Please let me know where I'm going wrong.

Sub macro2()
Dim c As Range
Range("A1").Select
For Each c In Worksheets("Report").Range("A6:a1000").Cells
If Len(c.Value) = 1 Then Selection.EntireRow.Delete
ActiveCell.Offset(1, 0).Select
Next
End Sub


Thanks for you help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top