Delete rows based on contents of Col A

Joined
Jun 20, 2014
Messages
2
Reaction score
0
I am new to VBA programming and am hoping I can get some help with a problem that has me stuck.

I have a formula, in the first 1,000 rows of column A, that evaluates to either a long text string or to "". I am trying to write VBA code to delete all rows where column A =""

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. However, I getting a syntax error and my VBA vocabulary is too small to figure out the problem. 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 your 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