+ Reply to Thread
Results 1 to 12 of 12

Macro to send individual tabs from a worksheet to different email address based on in

  1. #1
    Registered User
    Join Date
    07-29-2010
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    8

    Question Macro to send individual tabs from a worksheet to different email address based on in

    I create a master spreadsheet each week that contains anywhere from 1 to 40 tabs. Each tab contains the same header and a varying number of rows. The text in column D should determine the correct email address for the individual tab to be sent to (in an attached excel file). For example, if the data on the second tab in column D =”SupplierA”, then that tab should be send to “[email protected]”. If the third tab has “SupplierB” listed in column D, it should be sent to [email protected]. There won’t always been the same group of suppliers each week. So, if –for example- “SupplierP” (that is supposed to be sent to [email protected]) is not listed on one of the tabs, I would need the macro to just move on, without it failing.

    Does anyone know of a solution for this scenario? Any help would be greatly appreciated!!! Also, don’t hesitate to ask if I need to clarify anything…

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to send individual tabs from a worksheet to different email address based o

    I suppose there is another sheet somewhere that lists your suppliers in one column and the email address to send to in the next column, yes?

    Post up a sample workbook with this suppliers list already started and two or three sample data sheets. From that I can construct a quick macro for you.

    The macro can send each page as its own attached workbook, or even better...as an HTML email so the user can simply read the data in his email...no Excel needed for the recipient.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    07-29-2010
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro to send individual tabs from a worksheet to different email address based o

    First of all- thank you SO much again. I can't tell you how much I appreciate this.

    My main objective with this is to 1) create a master file with each of the suppliers (from the “2010-08.12 MASTER FILE_SAMPLE” that I’ve attached) separated out onto individual tabs for reference purposes and 2) have each on the tabs sent through Outlook to the corresponding contact for the individual supplier. The list of contacts for each supplier would be compiled as a list like the “supplier contact list” that I’ve attached). The file that I would like send to the supplier for Acclaim- for example- would look like “Acclaim_SAMPLE” file I attached.

    I originally thought that the macro you showed me before:
    'Summary: Based on selected column, data is filtered to individual sheets
    ' Creates sheets and sorts sheets alphabetically in workbook
    ' 6/10/2010 - added check to abort if only one value in vCol
    ' 7/22/2000 - added ability to parse numeric values consistently

    was working beautifully. However, when I tried this morning, I kept running into an error. The macro worked until the supplier “Bender Consulting Services, In”
    This was the portion of the macro that the debugger indicated was causing the issue:

    If Not Evaluate("=ISREF('" & MyArr(Itm) & "'!A1)") Then 'create sheet if needed
    Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = MyArr(Itm) &

    I’m not sure if it’s best to go at this with 2 separate macro (especially since I can’t get the first one to work), or just one… What do you recommend?
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to send individual tabs from a worksheet to different email address based o

    You can't have commas in sheet names. That's the problem. There's also a length of sheetname issue as well.

  5. #5
    Registered User
    Join Date
    07-29-2010
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro to send individual tabs from a worksheet to different email address based o

    Ahh... thank you. That worked. How about the rest? Please let me know if you have trouble viewing the worksheets I posted.

  6. #6
    Registered User
    Join Date
    07-29-2010
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro to send individual tabs from a worksheet to different email address based o

    Just checking back, have you had a chance to look at the spreadsheets I posted?

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to send individual tabs from a worksheet to different email address based o

    You indicated a single problem line of code and I provided the solution to that problem. What else did you need?

  8. #8
    Registered User
    Join Date
    07-29-2010
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Macro to send individual tabs from a worksheet to different email address based o

    Earlier you said "Post up a sample workbook with this suppliers list already started and two or three sample data sheets. From that I can construct a quick macro for you". I have since posted them- please let me know if you have troble viewing them and I'll try posting again.

    The macro that I was having the error message for was just the macro to parse info on the first tab to separate tabs based on the info in the forth column. I need help with a macro that can send the individual tabs via Outlook to specified recipients.

  9. #9
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to send individual tabs from a worksheet to different email address based o

    I had a macro for parsing rows of data from one sheet to many workbooks named for the same values in a specific column
    .
    I've edited that macro to utilize a separate supplier list and to email the resulting workbooks.

    This macro should be installed into your supplier list sheet. I also added a column to the supplier sheet to indicate what the wbnames created should be nicknamed.

    If you open a file and the data sheet being parsed is named 8.10.2010, then the wb created would be called 8.10.2010 Acclaim.xls and stored in the SvPath directory.

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

  10. #10
    Registered User
    Join Date
    04-24-2013
    Location
    italy
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Macro to send individual tabs from a worksheet to different email address based on in

    I would like to adapt this macro to my needs.

    - I have a supplier list that contains more than one row for each supplier, I should send the workbook to more than one e-mail address for each supplier.

    - On my supplier list I have two further columns of email addresses that should be put in CC to each e-mail. Below an example of the structure of my supplier list.

    supplierlist.png

    - The macro should filter by supplier three pivot tables contained in the same sheet. The result of filtering should be parsed into many workbooks and send by e-mail.Below an example of the main file to parse and email.

    main file.jpg

    The macro should filter by supplier in B2, B30 and B41 and by the current year in B3.

    Furthermore, is it possible to email the parsed data as body of the e-mail?

    I will be grateful to anyone who could help me.
    Last edited by 83dav83; 05-26-2013 at 07:00 AM.

  11. #11
    Registered User
    Join Date
    04-24-2013
    Location
    italy
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Macro to send individual tabs from a worksheet to different email address based on in

    A screen shot of the file to email:
    Attached Images Attached Images
    Last edited by 83dav83; 05-26-2013 at 07:17 AM.

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro to send individual tabs from a worksheet to different email address based on in

    83dav83,

    Unfortunately you need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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