+ Reply to Thread
Results 1 to 5 of 5

Code to send email & loop through sheet

  1. #1
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    214

    Code to send email & loop through sheet

    I would like to have a button that will generate an email with the following information:

    To field = Column (I & J)
    Subject = Please respond in regards to CID: (Column B) / Order #: (Column C) / Container #: (Column D)

    Body = Please advise once container #: (Column D) is picked up on (Column E) so the triage team can close out the order.

    It is setup as a table so I would need it to loop through each one on the sheet that does not have "X" in column K. I have attached the workbook so you can see what it all requires! Any help would be greatly apricated! Thank you so much in advance!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Code to send email & loop through sheet

    here's some prior examples you can pretty much copy
    https://www.excelforum.com/excel-pro...-due-date.html
    https://www.excelforum.com/excel-pro...xcel-file.html

    only difference would be looping thru table rather just plain jane spreadsheet
    want to have a crack at it first?
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Contributor
    Join Date
    02-12-2018
    Location
    Clearwater, FL
    MS-Off Ver
    MS 365
    Posts
    214

    Re: Code to send email & loop through sheet

    This is what I got which was working but something stopped when trying to merge code together! This is the code I came up with but nothing is displaying after I hit run - any advise?
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Code to send email & loop through sheet

    Sorry been caught up doing other stuff

    first thing that caught my eye when debugging
    Please Login or Register  to view this content.
    if you want to mimic blank ...no space is required
    like this
    Please Login or Register  to view this content.
    this said i think you have the logic the other way round it should be if cell = "" then proceed... so if cell is empty then continue with code
    Please Login or Register  to view this content.
    alternatively i suggest you use
    Please Login or Register  to view this content.
    ill do the rest of the code and come back later

  5. #5
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Code to send email & loop through sheet

    made a few changes
    you don't need to loop your data twice so i removed it completely

    updated your Body slightly to it reads better
    ps. VBNewline will give you a new line in body


    Please Login or Register  to view this content.
    updated slightly on how it updates when you actually go thru to displaying email

    full code and file attached

    Please Login or Register  to view this content.
    some other minor cosmetics and updated comments so you get a better idea on what i did
    Attached Files Attached Files

+ 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. while loop to check value condition and send email
    By mo7al-sa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-16-2018, 08:36 AM
  2. Code to send email with table on the email body via gmail
    By ivhee00 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-19-2017, 12:24 AM
  3. Loop through table and send individual report by email
    By eagleadam89 in forum Access Tables & Databases
    Replies: 1
    Last Post: 03-10-2016, 12:58 PM
  4. VBA code to send email to the people whose email address is in the Access table
    By aman1234 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-30-2014, 05:11 AM
  5. Code to send Email wont send everytime
    By tanktata in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-11-2011, 04:44 PM
  6. Loop through autofilter and send via email to address in column L
    By madamson86 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-02-2010, 10:01 AM
  7. [SOLVED] Loop through email address list to send e-mails
    By Paul. in forum Excel General
    Replies: 1
    Last Post: 04-12-2005, 08:06 AM

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