VBA - Remove rows where a cell in a column is NOT blank

aminero

New Member
Joined
Oct 24, 2019
Messages
4
Hi all,
I am trying to remove rows based on if a cell in column C is not blank for that row. Ive searched multiple threads but nothing is seeming to work for me. I have this one below that works great for removing rows where a cell IS blank. But I need to remove if the cell actually contains info.

Dim d9 As Range
Dim SrchRng9


Set SrchRng9 = ActiveSheet.Range("c2", ActiveSheet.Range("c1000").End(xlUp))
Do
Set d9 = SrchRng9.Find("", LookIn:=xlValues)
If Not d9 Is Nothing Then d9.EntireRow.Delete
Loop While Not d9 Is Nothing
 

VBE313

Board Regular
Joined
Mar 22, 2019
Messages
231
Office Version
365
Platform
Windows
Can you explain more what you need to do? Use sample data please
 

aminero

New Member
Joined
Oct 24, 2019
Messages
4
Hi, I am unable to attach a file per my permissions? But I have a data set for an open pipeline of orders with about 10 columns. Some of the orders get put on hold for various reasons. I am wanting to remove all orders that are on hold from the data. So I am either trying to keep all rows where the hold column (c) is empty, or I can remove rows where the hold column has an input. Since the inputs vary I was going with the keep rows where column c is blank route but either option would work. Does that make sense?
 

VBE313

Board Regular
Joined
Mar 22, 2019
Messages
231
Office Version
365
Platform
Windows
Please write it out like this. You can add a table on here


PipelineHold or not
Datadata

<tbody>
</tbody>
 
Last edited:

igold

Well-known Member
Joined
Jul 8, 2014
Messages
2,447
Office Version
365, 2010
Platform
Windows
How about this:

Code:
Sub delblanks()


    Dim SrchRng9 As Range
    Dim i As Long


    Set SrchRng9 = ActiveSheet.Range("c2", ActiveSheet.Range("c1000").End(xlUp))
    For i = SrchRng9.Rows.Count To 1 Step -1
        If SrchRng9.Cells(i) <> "" Then SrchRng9.Cells(i).EntireRow.Delete
    Next


End Sub
 
Last edited:

aminero

New Member
Joined
Oct 24, 2019
Messages
4
Thanks anyway VBE313. also, really? was I not clear enough? Was a table really necessary.
 

igold

Well-known Member
Joined
Jul 8, 2014
Messages
2,447
Office Version
365, 2010
Platform
Windows
You're welcome. I was happy to help. Thanks for the feedback!
 

Forum statistics

Threads
1,082,504
Messages
5,365,962
Members
400,864
Latest member
RobynP51

Some videos you may like

This Week's Hot Topics

Top