VBA IF Cell A is not blank And Cell D is Blank Then...

DJhuffman

New Member
Joined
Apr 16, 2019
Messages
25
Ok. Here's another one I've tried to reverse engineer all sorts of similar formulas I've seen, but I'm always falling short. Hopefully, this is easy to someone in the know.

Column A contains numerical strings in general format (don't know if that's important or not).
Column D contains dates.
I am trying to build into my macro a step that will check each cell with data in column A and then see if the corresponding cell in column D is blank or not. If it is blank, I would like to fill the cell with "'00/00/00".

Any assistance would be appreciated. Thank you in advance.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
See if this works for you.

Code:
Sub t()
Dim rng As Range, c As Range
    With ActiveSheet
        Set rng = Intersect(.Range("A:D"), .UsedRange)
        rng.AutoFilter 4, "="
        For Each c In rng.Offset(1).Columns(1).SpecialCells(xlCellTypeVisible)
            If c > "" Then
                c.Offset(, 3) = "00/00/00"
            End If
        Next
        .AutoFilterMode = False
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,020
Members
448,939
Latest member
Leon Leenders

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