Function / VBA to Delete Empty Rows or Skip Empty Rows

CuriousForge

New Member
Joined
Aug 20, 2018
Messages
24
___________BOOK 1___________________BOOK 2
OLa3gzb.jpg


These 2 workbooks are linked. The function in Book 2 column C2 (Decisions) is =IF([Book1]Sheet1!C2="Declined",C2,"").
I am looking for a function / VBA code to delete the blank/unmatched rows of Book 2 or modify the formula of C2 to skip cells that don't match the "Declined" criteria (i.e are 'Approved').
 
Last edited:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I am currently working on something very similar. I am a total beginner, and this is my 5th working code so far.

my code is as following:

Sub deleterows()
Dim st As Variant
`set starting point
Range("A2").Select

Do
If ActiveCell.Offset(0, 2).Value = "" Then
ActiveCell.Rows.EntireRow.Delete
ActiveCell.Offset(-1, 0).Select


End If

ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.Value = ""
End Sub


My file to work with is a Material file
A column: Material describtion
B column: package size
C column: price
D column: MaterialNumber

When I let this sub run, it will delete all the rows which have no price attached to the product.

Maybe someone can explain me, why my computer is so super slow. I am working on a Xeon Processor, and this short sub is really challenging my computer, though, it is doing what I want.

Hopefully that helps a littlebit, and maybe someone can explain me what I did wrong and why my computer takes so long for this.

thank you
Tim
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,315
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top