+ Reply to Thread
Results 1 to 7 of 7

Only send mail when condition is met!!!Please Help!

  1. #1
    Registered User
    Join Date
    01-26-2018
    Location
    California, US
    MS-Off Ver
    2016
    Posts
    9

    Only send mail when condition is met!!!Please Help!

    I had help writing this code by another user on this forum and the code works great, but there is still one issue I have with it. I want the email to only be sent when the "If" statement is met. Right now even if the condition is not met, an email is still sent just with no "Body" to the email. I believe that there should be something before the current "If" statement but not sure what. Can someone please help?

    Excel Macro.jpg

  2. #2
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    365
    Posts
    16,968

    Re: Only send mail when condition is met!!!Please Help!

    Sorry but that image is useless. Please attach your file, or at least copy the code, then paste it into a post, using CODE tags.

    The paper clip icon does not work for attachments. Instead, under the text box where you type your reply click the Go Advanced button. On the next screen scroll down and click on Manage Attachments, which will show a pop-up window to Select and Upload a file. Then close the window.

  3. #3
    Registered User
    Join Date
    01-26-2018
    Location
    California, US
    MS-Off Ver
    2016
    Posts
    9

    Re: Only send mail when condition is met!!!Please Help!

    Sorry here is the attachment. Thanks for that!
    Attached Images Attached Images

  4. #4
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    365
    Posts
    16,968

    Re: Only send mail when condition is met!!!Please Help!

    You just attached your image again. Please attach the actual Excel file. Thanks.

  5. #5
    Registered User
    Join Date
    01-26-2018
    Location
    California, US
    MS-Off Ver
    2016
    Posts
    9

    Re: Only send mail when condition is met!!!Please Help!

    Here is the code copied/pasted. Hope this works as well! I am new to this forum.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-26-2018
    Location
    California, US
    MS-Off Ver
    2016
    Posts
    9

    Re: Only send mail when condition is met!!!Please Help!

    Here is the attached spreadsheet.
    Attached Files Attached Files

  7. #7
    Forum Moderator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    365
    Posts
    16,968

    Re: Only send mail when condition is met!!!Please Help!

    Move the line with SendMail as shown:
    Please Login or Register  to view this content.

+ 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. Worsheet_Change with 4 condition to send mail
    By Nicopof in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-28-2015, 07:25 PM
  2. [SOLVED] cdo send send mail - getting my external .vbs script directly into a an excel worksheet
    By PieterBlan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2014, 08:10 AM
  3. Replies: 1
    Last Post: 03-11-2014, 12:24 PM
  4. Find duplicated cell, with certain condition and send mail under the same address.
    By EugeneE in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-28-2013, 11:49 PM
  5. Automatic send email (without even click send in mail software) with excel vba ??
    By alexnkc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-17-2013, 08:31 PM
  6. How to e-mail selected row and use e-mail address in a cell to send e-mail from excel
    By syedalamgir in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-27-2010, 02:15 AM
  7. Send e-mail based on condition
    By LPC in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-10-2009, 10:57 AM

Tags for this Thread

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