Results 1 to 5 of 5

pull email address from a column based on criteria from another column

Threaded View

  1. #1
    Registered User
    Join Date
    05-25-2016
    Location
    Erlanger, KY
    MS-Off Ver
    2010
    Posts
    81

    pull email address from a column based on criteria from another column

    I need to add a cc column to the email code that I have. I have an email that, once the button ("Send Return Due Date Email") is pushed it looks for anything with current date and sends an email to a specific person, but I need to be able to copy the technician in on the email. The technician names change based upon who has the part at that time. The code to send the email is: I'm not sure what to add to the Macro. I have also attached the file. The button for the email is on the Tools page as well as who the technician is (column I) and the email addresses are on the Indexes page in Columns AF:AG.

    Sub Mail_small_Text_Outlook()
    
        Dim OutApp As Object
        Dim OutMail As Object
        Dim strbody As String
       
        Set OutApp = CreateObject("Outlook.Application")
        Set OutMail = OutApp.CreateItem(0)
    
        ' -- CREATE BODY OF EMAIL PORTION START -----------------------
        
        strbody = "The Items listed below are expected to be returned to inventory today , " & Date & vbNewLine & vbNewLine
        
        Dim cell As Range
        Dim numRows As Integer
        
        ' Find out number of rows:
        numRows = Range("B6", Range("B6").End(xlDown)).Rows.Count
        
        ' Check each cell in Return Due Date and see if it matches today
        For Each cell In Range("M6:M" & numRows)
            
            If cell.Value = Date Then
            
                strbody = strbody & cell.Offset(0, -11).Value & vbNewLine
            
            End If
        
        Next
                  
        ' -- CREATE BODY OF EMAIL PORTION END ------------------------
    
        On Error Resume Next
       
        
        With OutMail
            .to = "cinstanl@hotmail.com"
            .cc = 
            .Subject = "Inventory Due Today"
            .Body = strbody
            .Display
        End With
        
        On Error GoTo 0
    
        Set OutMail = Nothing
        Set OutApp = Nothing
        
        ' Update date on sheet:
        shtInventoryList.Range("K3").Value = Date & " at " & Time
        
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy email address in column dependant on another column
    By N1k100 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-31-2015, 10:09 AM
  2. Formula to pull rows of data based on a column cell value (Criteria)
    By PaulLor89 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-30-2013, 11:26 AM
  3. [SOLVED] Extracting email chain email address and converting to Excel column
    By Leah_Hael in forum Excel General
    Replies: 4
    Last Post: 12-28-2012, 04:05 PM
  4. [SOLVED] Help with a formula to extract email address to a new column
    By Clarence Leong in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-11-2012, 04:05 AM
  5. Vlookup with email address column
    By lamp123 in forum Excel General
    Replies: 1
    Last Post: 06-11-2012, 11:54 AM
  6. [SOLVED] can I copy a column of email addresses, paste into email address?
    By Lizizfree in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 07-20-2006, 05:05 PM
  7. [SOLVED] How do you add a parentesis to a column of email address?
    By a_dallas_boy in forum Excel General
    Replies: 2
    Last Post: 02-18-2005, 10:06 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