+ Reply to Thread
Results 1 to 4 of 4

Email To: cell value on another worksheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Email To: cell value on another worksheet

    Hey all!

    I have a excel macro that does all kinds of things in an email. Copies snippets of data into there, saves and attaches its self to the email and sends it to an email address shown is a cell, as well as CC'ing whoever i need.
    The code used for this section is.

    With OutMail
        .To = [z6].Value & "; " & [aa6].Value & "; " & [ab6].Value
        .CC = ""
        .BCC = ""
    Which is perfect, BUT.......... id like the cells it reads the values from to be on another tab/sheet that will be hidden.

    How do i alter the above to read, for example, Z6 on another sheet named Email Template.

    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,984

    Re: Email To: cell value on another worksheet

    You could just store the recipients in a variable:

    Dim recip As Variant
    Dim rng As Range
    'if recipients are listed in column A
    With worksheets("Email Template")
        Set rng = .Range("A1:A" & .Cells(.Rows.Count, 1).End(xlUp).Row)
    End With
    'assign to variable
    recip = Join(Application.Transpose(rng.Value), "; ")
    'test
    msgbox recip
    with OutMail
        .To = recip
    end with
    Last edited by ByteMarks; 07-25-2018 at 11:56 AM.

  3. #3
    Valued Forum Contributor
    Join Date
    07-10-2017
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2013
    Posts
    430

    Re: Email To: cell value on another worksheet

    You could change
     [z6].value
    to
     sheets("Email Template").[z6].value

  4. #4
    Forum Contributor
    Join Date
    12-14-2017
    Location
    birmingham, england
    MS-Off Ver
    2016
    Posts
    102

    Re: Email To: cell value on another worksheet

    Cheers both.

    But in particular danielexcelvba. I'm after simplicity and what more could i ask for!

+ 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. attach different worksheet and email them tdifferent email address through macro/vba/addin
    By arunverma004 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-03-2014, 08:20 AM
  2. Using VBA to send Email by selecting email from a cell within a worksheet
    By sm.salford in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-17-2013, 01:58 PM
  3. Email worksheet depending on date or cell value
    By jmatthews in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-17-2013, 10:08 AM
  4. macro to email a worksheet as a pdf, using info from cell as subject.
    By abagnall in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 01-30-2013, 01:32 PM
  5. Email range from all worksheet with email address in cell
    By kevinarp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-20-2012, 05:03 PM
  6. How can I email a worksheet with a cell value as the 'Subject'?
    By rkjudy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2011, 12:48 PM
  7. macro to email cell contents from an excel worksheet
    By lrm75uk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-27-2011, 04:52 PM

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