Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-26-2019, 07:09 PM
Alansidman's Avatar
Alansidman Alansidman is offline IF cell in Col A is populated BUT cell in Col C is blank DELETE ROW Windows 10 IF cell in Col A is populated BUT cell in Col C is blank DELETE ROW Office 2019
עַם יִשְׂרָאֵל חַי
 
Join Date: Apr 2019
Location: Steamboat Springs
Posts: 112
Alansidman has a spectacular aura aboutAlansidman has a spectacular aura aboutAlansidman has a spectacular aura about
Default

Maybe this:
Code:
Option Explicit

Sub ChrisOK()
    Dim i As Long, lr As Long
    lr = Range("A" & Rows.Count).End(xlUp).Row
    Application.ScreenUpdating = False
    For i = lr To 1 Step -1
        If Range("C" & i) = "" Then
            Range("C" & i).EntireRow.Delete
        ElseIf Range("D" & i) = "#VALUE" Then
            Range("D" & i).EntireRow.Delete
        End If
    Next i
    Application.ScreenUpdating = True
    MsgBox ("Complete")
End Sub

Reply With Quote
  #2  
Old 04-28-2019, 02:30 AM
MagPower MagPower is offline IF cell in Col A is populated BUT cell in Col C is blank DELETE ROW Windows 10 IF cell in Col A is populated BUT cell in Col C is blank DELETE ROW Office 2019
Novice
 
Join Date: Feb 2019
Posts: 1
MagPower is on a distinguished road
Default

Quote:
Originally Posted by Alansidman View Post
Maybe this:
Code:
Option Explicit

Sub ChrisOK()
    Dim i As Long, lr As Long
    lr = Range("A" & Rows.Count).End(xlUp).Row
    Application.ScreenUpdating = False
    For i = lr To 1 Step -1
        If Range("C" & i) = "" Then
            Range("C" & i).EntireRow.Delete
        ElseIf Range("D" & i) = "#VALUE" Then
            Range("D" & i).EntireRow.Delete
        End If
    Next i
    Application.ScreenUpdating = True
    MsgBox ("Complete")
End Sub

I would use Alan's code, but with one modification of the first "If" statement:

If Range("C" & i) = "" And Range("A" & i) <> "" Then
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
IF cell in Col A is populated BUT cell in Col C is blank DELETE ROW Wish to delete letters to the right of the cursor in a Table cell, but whole cell is being deleted vjvj123 Word VBA 12 09-27-2018 03:09 PM
IF cell in Col A is populated BUT cell in Col C is blank DELETE ROW Fill blank cell with value from adjacent cell kevinbradley57 Excel Programming 2 04-17-2018 08:40 AM
IF cell in Col A is populated BUT cell in Col C is blank DELETE ROW Clear all cell colors within a range starting at cell A8 and change row of active cell to yellow FUGMAN Excel Programming 7 02-05-2017 08:37 AM
IF cell in Col A is populated BUT cell in Col C is blank DELETE ROW Need macro to delete a column with a blank cell dwirony Word VBA 2 10-20-2016 01:31 PM
How can I delete the content of a cell in column if the cell value is more than 1000? Learner7 Excel 2 06-27-2011 05:44 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:53 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft