Note: The other languages of the website are Google-translated. Back to English

How to quickly send email based on date in Excel cell?

Have you ever tried to send an Email based on date in Excel cell? For example, here is a list of dates in column A, and then you want to send an Email with the subject, message body to a recipient (also can CC and BCC to others), how can you handle it?

Send Email based on date with VBA

Send Email based on date with VBA

To send email based on the date in Excel, you only can apply a macro code.

1. Enable the sheet that contains data and date you use, and press Alt + F11 keys to enable the Microsoft Visual Basic for Applications window.

2. Click Insert > Module, and paste below code to the blank script. 

VBA: Send by date

Sub email()
    Dim xRg As Range
    Dim xRgEach As Range
    Dim xAddress As String
    Dim xEmail_Subject, xEmail_Send_From, xEmail_Send_To, xEmail_Cc, xEmail_Bcc, xEmail_Body As String
    Dim xMail_Object, xMail_Single As Object
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xRg = Application.InputBox("Select a range:", "KuTools For Excel", xAddress, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    For Each xRgEach In xRg
        If xRgEach.Value = Date Then
            xEmail_Subject = Application.InputBox("Subject: ", "Kutools", , , , , , 2)
            xEmail_Send_From = Application.InputBox("Send from: ", "KuTools For Excel", , , , , , 2)
            xEmail_Send_To = Application.InputBox("Send to: ", "KuTools For Excel", , , , , , 2)
            If xEmail_Send_To = "" Then Exit Sub
            xEmail_Cc = Application.InputBox("CC: ", "KuTools For Excel", , , , , , 2)
            xEmail_Bcc = Application.InputBox("BCC: ", "KuTools For Excel", , , , , , 2)
            xEmail_Body = Application.InputBox("Message Body: ", "KuTools For Excel", , , , , , 2)
            Set xMail_Object = CreateObject("Outlook.Application")
            Set xMail_Single = xMail_Object.CreateItem(0)
            With xMail_Single
                .Subject = xEmail_Subject
                .To = xEmail_Send_To
                .cc = xEmail_Cc
                .BCC = xEmail_Bcc
                .Body = xEmail_Body
            End With
        End If
End Sub

3. Click Run button or press F5 key to execute the code, a dialog pops out to remind you to select a list of date. See screenshot:
doc send by date 1

4. Click OK, and continue to specify the email subject, sender’s email address, receiver’s email address, the CC, BCC, and message body. See screenshot:

doc send by date 2 shot arrow right doc send by date 3 shot arrow right doc send by date 4
        doc arrow down
doc send by date 7 shot arrow left doc send by date 6 shot arrow left doc send by date 5

5. Click OK > OK until last one, and then the email has been sent.
doc send by date 8

Note: the sender’s email address must be the default account in your Outlook.

Create Mailing List and Send Emails

doc send email

The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office / Excel 2007-2021 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
Comments (14)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
How do I get VBA in Excel to generate an email when a cell changes color? I am able to use formula to have cells' font change, based on the computer clock, when a date is within a range before expiry. I currently have a spreadsheet with 25 employee's names and the dates of expiry for their driver's license, work permits, entry/exit visa dates, and annual start date. Some dates are 30 days, some are 60 days. Whenever a date enters the 30 (or 60) day range before expiry, the value in the cell changes from normal black to bold red font. I want to be able to have an email sent to me warning that the person in A1...A2...A3, etc. is about to have a work document expire. What is the script I need to run to accomplish this?
This comment was minimized by the moderator on the site
This comment was minimized by the moderator on the site
This is close to what I need but I am stuck with two problems. 1st I need to run this across my entire workbook that gets new worksheets added daily. 2nd I need it to include the worksheet name in the email so I will know which sheet is due. I create new tickets (worksheets) with a field that is a future date, when that day arrives I need an email. Thank you for your help.
This comment was minimized by the moderator on the site
Felicidades por el material; pero no me funciona. Al parecer el Rango no se llena, por ende queda vacío y sale de la rutina.

Alguna corrección ?
This comment was minimized by the moderator on the site
holagracias por tu ayuda...tengo una consulta.....en la formula Set xRgDate = Application.InputBox("Please select the due date column:", "KuTools For Excel", , , , , , 8), el 8 que significa?
This comment was minimized by the moderator on the site
The boxes do not automatically populate after I hit OK. Where do I change the subject, email address and body of the email in the code?
This comment was minimized by the moderator on the site
Bonjour j'ai copié les codes, à la validation il me demande bien les cellules concernées, mais lorsque que je valide, il ne me propose pas la suite des fenêtres, sujets, adresses etc
This comment was minimized by the moderator on the site
Hi, boutry, sorry I that reply with English since I do not know French. May I know your date time format? I guess maybe the code only work for datetime in English date format.
This comment was minimized by the moderator on the site
Merhaba, bir excel dosyasında hatırlatıcı olarak bu konuyla ilgili VSB nin nasıl yapıldığı ile ilgili bilgiye ihtiyacım var. Örneğin boş bir hücreye bilgi girildiğinde bana mail at ya da 3 hafta sıklıkla hücreye bilgi girilip girilmediğiyle alakalı bana bilgi ver.

Hertürlü bilgi ve kaynağa açığım. Şimdiden herkese teşekkür ederim..
This comment was minimized by the moderator on the site
Hi, Mehmet, here is a tutorial How To Send Email If A Certain Cell Is Modified In Excel? that talking about sending an email with the excel file as attachment if the cells in the specific range are modified, which may help you.
This comment was minimized by the moderator on the site
Çok teşekkür ederim..
This comment was minimized by the moderator on the site
its not going on next xRgEach if i am having same dates multiple times, its sending mails to same user multiple times.
This comment was minimized by the moderator on the site
Hi, vaibhav, you can remove the duplicate times by using Remove Duplicates feature in Data Tools under Data tab, then using the VBA.
This comment was minimized by the moderator on the site

That is perfect, but when I add or change a date, it wont send the email Automatiklicht, I have to run the code again and by that I have to choose date range, sender, receiver and all info again. is there anyway to solve this issue?
There are no comments posted here yet
Leave your comments
Posting as Guest
Rate this post:
0   Characters
Suggested Locations

Follow Us

Copyright © 2009 - | All rights reserved. Powered by ExtendOffice. | Sitemap
Microsoft and the Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.
Protected by Sectigo SSL