Solved

Conditionally deleted row on empty string in cell

Posted on 2014-09-10
4
94 Views
Last Modified: 2014-09-10
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
Comment
Question by:AndreasHermle
  • 2
4 Comments
 
LVL 6

Expert Comment

by:Russell Lucas
ID: 40314893
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
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40314912
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
 

Author Comment

by:AndreasHermle
ID: 40315002
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
 

Author Closing Comment

by:AndreasHermle
ID: 40315007
As always great and swift coding from your side.

Thank you very much for it. Regards, Andreas
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question