All,
This is the VBA code.
Can you give me some way to make this work pls.
Sub LoopCheckValue()
Dim cell As Range
Dim i As Integer
i = 4
For Each cell In ActiveSheet.Range("J5:J13")
'What's the criteria?
If (cell.Value <= 0) Then
Set Outapp = CreateObject("Outlook.Application")
Set Outmail = Outapp.CreateItem(0)
With Outmail
.to = "mail" 'CHANGE THIS
.CC = ""
.BCC = ""
.Subject = [F2].Value + " Item due date reached"
.Body = Range("A" & i).Value & " is due "
.Send 'or use .Display
End With
ElseIf (cell.Value >= 30) And (cell.Value < 180) Then
Set Outapp = CreateObject("Outlook.Application")
Set Outmail = Outapp.CreateItem(0)
With Outmail
.to = "mail" 'CHANGE THIS
.CC = ""
.BCC = ""
.Subject = [F2].Value + " Item due date reached"
.Body = Range("A" & i).Value & " is due in less then 30 days"
.Send 'or use .Display
End With
ElseIf (cell.Value < 180) Then
Set Outapp = CreateObject("Outlook.Application")
Set Outmail = Outapp.CreateItem(0)
With Outmail
.to = "mail" 'CHANGE THIS
.CC = ""
.BCC = ""
.Subject = [F2].Value + " Item due date reached"
.Body = Range("A" & i).Value & " is due in less then 180 days"
.Send 'or use .Display
End With
End If
i = i + 1
Next cell
End Sub
Private Sub Worksheet_Selection(ByVal target As Range)
If ActiveCell.NumberFormat = "dd-mmm-yy," Then
ActiveSheet.Shape("Calendar").Visible = True
ActiveSheet.Shape("Calendar").Left = ActiveCell.Left + ActiveCell.Width
ActiveSheet.Shape("Calendar").Top = ActiveCell.Top + ActiveCell.Height
Else: ActiveSheet.Shape("Calendar").Visible = False
End If
End Sub