Hello,
I need your help to check what am I doing wrong.This is the table I am working on, called "ActionTable".
What I want: filter for empty fields of status column with VBA code, and insert "NO ACTION STARTED YET" to Status and Letter column, plus the actual date to ADDED_ON column.
The problem is, that if there is no record to show, the macro stops, even if I used an IF statement.
The error message is "runtime error 1004. no cells were found"
Can you please help me?
[TABLE="border: 1, cellpadding: 0, cellspacing: 0"]
[TD="width: 108"]HOSTNAME_DB[/TD]
[TD="width: 142"]Finding[/TD]
[TD="width: 203"]DB Cluster[/TD]
[TD="width: 84"]Running on[/TD]
[TD="width: 173"]Comment[/TD]
[TD="width: 158"]Status[/TD]
[TD="width: 461"]Letter[/TD]
[TD="width: 149"]Contacts[/TD]
[TD="width: 85"]ADDED_ON[/TD]
[TD="width: 102"]Letter sent on[/TD]
[TD="width: 105"]Next reminder[/TD]
a
[/td]something
[/td]N/A
[/td]comments
[/td]status
[/td]Info
[/td]a
[/td]
[TD="align: right"]06.02.2018[/TD]
[TD="align: right"]06.02.2018[/TD]
b
[/td]something
[/td]N/A
[/td]comments
[/td]status
[/td]Info
[/td]b
[/td]
[TD="align: right"]06.02.2018[/TD]
[TD="align: right"]06.02.2018[/TD]
c
[/td]something
[/td]N/A
[/td]comments
[/td]status
[/td]Info
[/td]c
[/td]
[TD="align: right"]06.02.2018[/TD]
[TD="align: right"]06.02.2018[/TD]
d
[/td]something
[/td]N/A
[/td]comments
[/td]status
[/td]Info
[/td]d
[/td]
[TD="align: right"]06.02.2018[/TD]
[TD="align: right"]06.02.2018[/TD]
e
[/td]something
[/td]N/A
[/td]comments
[/td]status
[/td]Info
[/td]e
[/td]
[TD="align: right"]06.02.2018[/TD]
[TD="align: right"]06.02.2018[/TD]
f
[/td]something
[/td]N/A
[/td]comments
[/td]status
[/td]Info
[/td]f
[/td]
[TD="align: right"]06.02.2018[/TD]
[TD="align: right"]06.02.2018[/TD]
g
[/td]something
[/td]N/A
[/td]comments
[/td]status
[/td]Info
[/td]g
[/td]
[TD="align: right"]06.02.2018[/TD]
[TD="align: right"]06.02.2018[/TD]
h
[/td]something
[/td]N/A
[/td]comments
[/td]status
[/td]Info
[/td]h
[/td]
[TD="align: right"]06.02.2018[/TD]
[TD="align: right"]06.02.2018[/TD]
[/TABLE]
Sheets("ACTION").Select
If (ActiveSheet.AutoFilterMode And ActiveSheet.FilterMode) Or ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
ActiveSheet.ListObjects("ActionTable").Range.AutoFilter Field:=6, Criteria1:="="
If ActiveSheet.Cells(rows.Count, 1).End(xlUp).Row > 1 Then
With Sheets("ACTION")
lLastRow = .Cells(.rows.Count, "A").End(xlUp).Row
With .Range("F2:F" & lLastRow)
.SpecialCells(xlCellTypeVisible).FormulaR1C1 = "NO ACTION STARTED YET" ' Macro stops at this point
End With
With .Range("G2:G" & lLastRow)
.SpecialCells(xlCellTypeVisible).FormulaR1C1 = "NO ACTION STARTED YET"
End With
With .Range("I2:I" & lLastRow)
.Value = Date
.NumberFormat = "dd/mm/yyyy"
End With
End With
Else
End If