VBA Excel

sheetname

New Member
Joined
Feb 19, 2020
Messages
11
Office Version
  1. 365
Platform
  1. Windows
I am trying to remind my self for due dates by using below code.After i run it sends me emails for all cases when date is achieved but when i put another due date it did not work if i do not run again.Please i need some help.
Option Explicit

Sub email()

Dim r As Range
Dim cell As Range
Set r = Range("A361:A370")

For Each cell In r

If Date - cell.Value = 30 Then

Dim Email_Subject, Email_Send_From, Email_Send_To, _
Email_Cc, Email_Bcc, Email_Body As String
Dim Mail_Object, Mail_Single As Variant

Email_Subject = "Reminder"
Email_Send_From = "rdube02@gmail.com"
Email_Send_To = "rdube02@gmail.com"
Email_Cc = ""
Email_Bcc = ""
Email_Body = "Please remind "

On Error GoTo debugs
Set Mail_Object = CreateObject("Outlook.Application")
Set Mail_Single = Mail_Object.CreateItem(0)
With Mail_Single
.Subject = Email_Subject
.To = Email_Send_To
.cc = Email_Cc
.BCC = Email_Bcc
.Body = Email_Body
.send
End With

End If

Next


Exit Sub

debugs:
If Err.Description <> "" Then MsgBox Err.Description
End Sub
 
It worked ,great operation in only two hours because of your help.
I spent two days and could not have done before.
Another time i appreciate what your help.
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hello again,sorry but you know as better we are doing more improvement we like to do.You helped me a lot but i have another question:Because i work three days ,the VBA code does not recognize the the dates when i am not in work and with few words it can not catch the the dates that correspond to my missing days. Just to remember my condition if was as below:
If Date - cell.Value = 30 then do .... I think here is my problem because it works fine when excel is open but i would to work and for my missing days.
Do you have any suggestion?
Thanks.
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,541
Members
449,089
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top