I realized there were missing dates in column A. I thought either all dates of years were present or that the dates in titles were dates present in column A.
I modifiied the macro to take this into account.
It leaves you to make sure there is a date when a company is marked DEAD or SUSP.
I also added 2 message box to tell you when the macro was completed normally and when it encounters an error with the company name causing the error.
Public Sub Blank_Dead()
Dim C_ell As Range, C_ell2 As Range, R_start As Range
Dim D_ay As Integer, M_onth As Integer, Y_ear As Integer
Application.ScreenUpdating = False
On Error GoTo E_nd
For Each C_ell In Range("B1", Cells(1, Columns.Count).End(xlToLeft))
If InStr(1, C_ell, "dead", vbTextCompare) Or InStr(1, C_ell, "susp", vbTextCompare) Then
D_ay = Mid(C_ell, InStr(1, C_ell, "/", vbTextCompare) - 2, 2)
M_onth = Mid(C_ell, InStr(1, C_ell, "/", vbTextCompare) + 1, 2)
Y_ear = Mid(C_ell, InStr(InStr(1, C_ell, "/", vbTextCompare) + 1, C_ell, "/", vbTextCompare) + 1, 2)
d_ate = DateSerial(Y_ear, M_onth, D_ay)
Do While R_start Is Nothing
Set R_start = Columns(1).Find(d_ate)
d_ate = d_ate + 1
Loop
For Each C_ell2 In Range(Cells(R_start.Row, C_ell.Column), Cells(Rows.Count, C_ell.Column).End(xlUp))
C_ell2 = ""
Next
Set R_start = Nothing
End If
Next
MsgBox "Ended without error", vbOKOnly, "COMPLETTED"
Exit Sub
E_nd:
Application.ScreenUpdating = True
MsgBox "Stopped because an error occured with company " & C_ell, vbOKOnly, "ERROR"
End Sub
Hoping it is all right now.
Bookmarks