0

I want to run a code that will go down all of column D (D:D) in my sheet named PxV and if they find a blank cell it will completely delete that corresponding row. Another caveat is idk if my cells are truly blank? There is a formula running through all the cells and if it is false returns "". Idk if this would be recognized as blank by VBA so if you would have to delete cells that have "" even though they're blank. It would also be nice to run continuously so when new data is populates it runs but I am not sure if that is possible . Thanks!!!

3
  • 1
    Have you written any code yet to solve this or is that something you were hoping we would do for you? If you have written some code, even if it's not working, please share. As it's written there is like 5 questions in 1 here. Commented Jul 1, 2022 at 14:45
  • @JNevill I have no code on my end, was hoping for some direction or linkage to other forums which had an answer I could mold myself. This is my first time ever trying VBA so not quite sure how to build from scratch Commented Jul 1, 2022 at 14:56
  • 1
    Gotcha. It's tough to get started. I think searching for things like "Delete rows in a loop that meet criteria VBA" would give you some good results. Futhermore "Run subroutine every time worksheet changes VBA" will solve the other half. I know how difficult it is to search for this stuff when you aren't even sure what words/language to use. Commented Jul 1, 2022 at 15:04

1 Answer 1

0

See if this works. You'll need to edit the code to match your sheet name and column.

Sub DelRow()
Dim ws As Worksheet
Dim SheetsToSearch, SrchStrg As String, r As Range
Set ws = Sheets("Sheet1")
SrchStrg = ""
SrchStrg2 = 0

Application.ScreenUpdating = False
    With ws.Range("A:A")
        Set r = .Find(what:=SrchStrg, After:=.Range("A1"))
        For Each r In ws.Range("A1:A1000")
            If r = SrchStrg Then
                r.EntireRow.Delete
            ElseIf r = SrchStrg2 Then
                r.EntireRow.Delete
            End If
        Next
    End With
Application.ScreenUpdating = True
End Sub
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.