Conditionally deleted row on empty string in cell

Dear Experts:

For the selection on the current worksheet (A70:E80) the following macro action has to be performed:

Check whether the cells in  A70:A80 have an empty string (the empty string stems from a formula) and if so, the whole row has to be deleted.

Help is very much appreciated. Thank you very much in advance.

Regards, Andreas
Andreas HermleTeam leaderAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Rgonzo1971Connect With a Mentor Commented:
Hi,

pls try

Sub Macro()

Set myRange = Selection.Resize(Selection.Rows.Count, 1)
For Idx = myRange.Row + myRange.Rows.Count - 1 To myRange.Row Step -1
    If Cells(Idx, myRange.Column).Value = "" Then
        Cells(Idx, myRange.Column).EntireRow.Delete
    End If
Next

End Sub

Regards
0
 
Russell LucasIT Infrastructure Project ManagerCommented:
Initially I would ask; when you say delete the row do you mean make the rows values zero or remove the row moving all others up. The latter would change the size of the space you are working on.

Also are you working on a selection or an absolute range? Will additional cells be added to the worksheet, and if so will they also need to be processed?
0
 
Andreas HermleTeam leaderAuthor Commented:
Hi Russell,

I may have been a little vague in my questioning therefore your questions are justified.

nevertheless, Rgonzo macro works just great.

Thank you very much for your great help, anyways.
0
 
Andreas HermleTeam leaderAuthor Commented:
As always great and swift coding from your side.

Thank you very much for it. Regards, Andreas
0
All Courses

From novice to tech pro — start learning today.