Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 101
  • Last Modified:

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
0
AndreasHermle
Asked:
AndreasHermle
  • 2
1 Solution
 
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
 
Rgonzo1971Commented:
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
 
AndreasHermleAuthor 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
 
AndreasHermleAuthor Commented:
As always great and swift coding from your side.

Thank you very much for it. Regards, Andreas
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now