1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| Sub new_action()
Call filter_reset
col_dash = Range("A:XFD").Cells.Find("#", lookat:=xlWhole).Column
last_row = Range("A105476").Cells.End(xlUp).Row
col_date = Range("A:XFD").Cells.Find("Date", lookat:=xlWhole).Column
col_status = Range("A:XFD").Cells.Find("Status", lookat:=xlWhole).Column
col_object = Range("A:XFD").Cells.Find("Object", lookat:=xlWhole).Column
col_what = Range("A:XFD").Cells.Find("What", lookat:=xlWhole).Column
col_who = Range("A:XFD").Cells.Find("Who", lookat:=xlWhole).Column
col_why = Range("A:XFD").Cells.Find("Why", lookat:=xlWhole).Column
col_due_date = Range("A:XFD").Cells.Find("Due date", lookat:=xlWhole).Column
col_new_date = Range("A:XFD").Cells.Find("New date", lookat:=xlWhole).Column
col_closure_date = Range("A:XFD").Cells.Find("Closure date", lookat:=xlWhole).Column
cell_date = Cells(last_row + 1, col_date).Address
cell_status = Cells(last_row + 1, col_status).Address
cell_object = Cells(last_row + 1, col_object).Address
cell_what = Cells(last_row + 1, col_what).Address
cell_who = Cells(last_row + 1, col_who).Address
cell_why = Cells(last_row + 1, col_why).Address
cell_due_date = Cells(last_row + 1, col_due_date).Address
cell_new_date = Cells(last_row + 1, col_new_date).Address
cell_closure_date = Cells(last_row + 1, col_closure_date).Address
Cells(last_row + 1, col_dash).Value = Cells(last_row, col_dash).Value + 1
Cells(last_row + 1, col_date).Value = Format(Now, "mm/dd/yyyy")
formule = "=IF(OR(" & cell_due_date & "=""n/a""," & cell_new_date & "=""n/a""),""Standby""," & _
"IF(" & cell_closure_date & "=""Cancelled"",""Cancelled""," & _
"IF(OR(" & cell_object & "=""""," & cell_date & "=""""," & cell_what & "=""""," & cell_who & "=""""," & cell_why & "=""""," & cell_due_date & "=""""),""""," & _
"IF(" & cell_closure_date & "<>"""",""Closed"",IF(OR(" & cell_due_date & ">=TODAY()," & cell_new_date & ">=TODAY()),""Ongoing""," & _
"IF(AND(" & cell_due_date & "<TODAY()," & cell_closure_date & "=""""),""Late"",))))))"
Worksheets("Action plan").Range(cell_status).Formula = formule
End Sub |
Partager