+ Reply to Thread
Results 1 to 11 of 11

Send email when any cell in a specific column reads below a certain number...

  1. #1
    Registered User
    Join Date
    08-28-2017
    Location
    Denton, TX
    MS-Off Ver
    2016
    Posts
    5

    Send email when any cell in a specific column reads below a certain number...

    Hey All,

    I'm completely new to messing with any of this, so I really appreciate your patience and help! I'm attempting to set up a spreadsheet to track maintenance/warranties on gear at work. Basically we have a column for each item, type of warranty, length of warranty, and days left. At this point I have it set up to email me when the value of a specific cell in the Days Left column (column H) reaches 90 (90 days of maintenance left, time to renew). What I'm trying to do is get it to send an email when any cell value in column H hits 90. I've pasted below what I have so far. Instead of "H4" I'm trying to figure out how to say "anything in column 4".

    Thanks!

    Private Sub Workbook_Open()
    Dim w As Worksheet, c As Comment
    For Each w In ThisWorkbook.Worksheets
    Select Case w.Range("H4").Value
    Case Is <= 90
    Set c = w.Range("H4").Comment
    If c Is Nothing Then
    send_mail w.Range("H4").Value, w.Range("I6").Value
    ElseIf c.Text <> w.Range("H4").Value & " day reminder sent." Then
    send_mail w.Range("H4").Value, w.Range("I6").Value
    End If
    End Select
    Next w
    Set c = Nothing
    Set w = Nothing
    End Sub
    Private Function send_mail(numdays As Variant, eaddress As String)
    Dim O, m
    Set O = CreateObject("Outlook.Application")
    Set m = O.CreateItem(0)
    With m
    .To = eaddress
    .CC = ""
    .BCC = ""
    .Subject = "Maintenance Warning"
    .Body = "There are one or more items with less than 90 days of maintenance left."
    .Display 'or use .Display
    End With
    Set m = Nothing
    Set O = Nothing
    End Function

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Send email when any cell in a specific column reads below a certain number...

    .
    I already had something like this in my folder.

    Paste this into a Routine Module :


    Please Login or Register  to view this content.

    Paste this into the Sheet Level module where the <=90 will appear in Column H:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-28-2017
    Location
    Denton, TX
    MS-Off Ver
    2016
    Posts
    5

    Re: Send email when any cell in a specific column reads below a certain number...

    I really appreciate your help! I couldn't get the email to pop up when I first tried but I admittedly haven't spent much time on it. I'll keep working and let you know how it goes. Thanks again.

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Send email when any cell in a specific column reads below a certain number...

    .
    Look at this attached
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-28-2017
    Location
    Denton, TX
    MS-Off Ver
    2016
    Posts
    5

    Re: Send email when any cell in a specific column reads below a certain number...

    Thanks for the quick reply. Is there a way to get it to display the email when the workbook is opened? I had to run the macro to get it to pop up. (Changed email address in module.)

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Send email when any cell in a specific column reads below a certain number...

    .
    Paste this into the ThisWorkbook Module :

    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    08-28-2017
    Location
    Denton, TX
    MS-Off Ver
    2016
    Posts
    5

    Re: Send email when any cell in a specific column reads below a certain number...

    Okay, I'm slowly getting there! It's now popping up the email but doing it every time, regardless of what I have in the range. I changed it to H2:H5 just for testing and put 1000 in each of those cells.

  8. #8
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Send email when any cell in a specific column reads below a certain number...

    .
    I've been exploring how to check (when the workbook is opened) if there is a value in Col H less than 90. Guess my old mind is tired. Haven't got there yet.

    Understand this is not a professional endeavor for me ... just a hobby. I'll keep pluggin' away.

    By the way, I didn't fully test that last file I sent. There was an error in it. Try this one.
    Attached Files Attached Files

  9. #9
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Send email when any cell in a specific column reads below a certain number...

    .
    Paste this macro in the ThisWorkbook module :

    Please Login or Register  to view this content.

    Paste this in the Routine Module below the email macro

    Please Login or Register  to view this content.
    Review the attached.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    08-28-2017
    Location
    Denton, TX
    MS-Off Ver
    2016
    Posts
    5

    Re: Send email when any cell in a specific column reads below a certain number...

    That did it! I can't tell you how much I appreciate your help. I owe you a beer or 12. I'll let you know how the final product turns out. Thanks again!

  11. #11
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Send email when any cell in a specific column reads below a certain number...

    .
    Great ! Glad to help.

    You'll need to keep the beer with all the bad stuff happening in Tx right now.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to send Automated Email when specific cell value reached due date
    By grlinks in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-15-2016, 12:22 AM
  2. Send an ALERT email to a GMAIL address if conditions are met in a specific cell
    By zeegerman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-25-2015, 04:56 PM
  3. [SOLVED] Need a Macro to send an email to an address once a date in a specific cell expires
    By Cvaught8 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-01-2015, 12:04 PM
  4. Clicking email links to send specific cell information
    By Dessesbo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-24-2013, 10:36 AM
  5. Send Email in Excel 2011 (Mac) using Mac Mail on date in specific cell
    By drjanand in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-17-2012, 10:32 AM
  6. send an email based on data in specific cell
    By savage in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-28-2010, 11:54 AM
  7. [SOLVED] how do you send a email from an specific excel column (database)..
    By Email from database in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2005, 06:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1