PDA

View Full Version : [SOLVED:] message box when tasks due and not complete



CuriousGeorg
11-13-2013, 05:04 AM
Good morning,

I have a msgbox appear on opening the worksheet if a task is due within 7 days.




Private Sub Workbook_Open()


Dim rngCell As Range

For Each rngCell In Application.Intersect(Range("F6:F" & Rows.Count), Range("F6").CurrentRegion)
If rngCell.Value <= 7 Then
MsgBox "TASK DUE " & vbLf & vbLf & _
"Task: " & Range("B" & rngCell.Row) & ". Who: " & Range("C" & rngCell.Row)
End If
Next rngCell

Set rngCell = Nothing


End Sub


Is there a way I can alter this code so that either:
a. it doesnt pop up if cell H says completed or
b. it doesnt pop up if date (days remaining) column is blank?


im thinking that it might be as simple as adding an "AND" for a range to the "if rngCell" line.. but i dont know

SamT
11-13-2013, 08:02 AM
If rngCell.Value <= 7 And LCase(rngCell.Offset(0, 2)) <> "completed" And [Cell_In_Days_Remaining_Column] <>"" Then

CuriousGeorg
11-14-2013, 01:04 AM
yet again SamT you've resolved it! thanks.

I really should remember about offset. I knew it'd be something small!

cheers