deleting rows were there

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Deleting Rows were there are formulas that return a nil value

Deleting Rows were there are formulas that return a nil value

resolvedResolved · High Priority · Version 2003

Mona has attended:
Excel VBA Intro Intermediate course
Excel VBA Advanced course

Deleting Rows were there are formulas that return a nil value

How do you write a code which deletes rows where the row contains formulas which returns a nil value.

RE: Deleting Rows were there are formulas that return a nil valu

Hi Mona

Thanks for the question.

I am assuming the values you are wanting to check are in known columns. For my simple example I am assuming the formula is in the B column and my data starts in row one and stops when the formulas stop.


Range("B1").Select
Do Until Activecell.Formula=""
If Activecell.Value=vbNullString Then
Activecell.Entirerow.Delete
Else
ActiveCell.Offset(1,0).Select
End If
Loop


Let me know if that helps.

Laura GB

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Closing Multiple Workbooks quickly

When you have several workbooks open in Excel and want to just close them all at once:

1) Hold down the SHIFT key before selecting the File menu.

2) Once in File menu release SHIFT key and select Close All option.

3) All your files will close. If files require saving Excel will ask if you want to save the changes.

View all Excel hints and tips


Server loaded in 0.08 secs.