I put my open tasks into a spreadsheet.
I want to make any late tasks red and bold. This code also set three lines red, bold that are not late.
Because the ones that are incorrect are in the same month as current date, I am guessing that I have a data type mismatch, or something like that.
I tried CDate
.
y = 2
For x = 1 To tasks.Count
Set tsk = tasks.Item(x)
'Fill in Data
If Not tsk.Complete Then
exWb.Sheets("Sheet1").Cells(y, 1) = tsk.DueDate
exWb.Sheets("Sheet1").Cells(y, 2) = tsk.Subject
If tsk.DueDate < Date Then
MsgBox tsk.DueDate & " " & Date
'Make red bold
exWb.Sheets("Sheet1").Cells(y, 1).Font.Bold = True
exWb.Sheets("Sheet1").Cells(y, 1).Font.Color = RGB(255, 0, 0)
End If
exWb.Sheets("Sheet1").Cells(y, 3) = tsk.PercentComplete
exWb.Sheets("Sheet1").Cells(y, 4) = tsk.Status
y = y + 1
End If
Next x