+ Reply to Thread
Results 1 to 15 of 15

filter and copy from excel into an e-mail (Body text).

  1. #1
    Registered User
    Join Date
    02-11-2013
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    58

    filter and copy from excel into an e-mail (Body text).

    Hi,

    I am struggling with a filter and copy from excel into an e-mail (Body text).
    I have a spreadsheet with 213 rows in it and I would like this to be filtered by column G. There are 90 different numbers in column G, so I am thinking that a macro would need to run alongside a vlook up to find and filter the data. But if there is another way of doing it then that could be ok instead.
    Then for each filtered data to be copied in to the body text of an e-mail and then sent. This could be sent as an attachment but body text would be best.

    I can make the e-mail part, but I am having trouble with the filter and copy part. After looking around and getting lots of help from Yudlugar (thanks again), I just don’t seem to be able to work out how to filter the data and copy it into the body of an e-mail.
    If anyone has any ideas, It would help me very much.
    Below is what I have so far.
    Thanks in advance
    Rob

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: filter and copy from excel into an e-mail (Body text).

    Can you better describe the nature of your data, the criteria of the filtering, and what part(s) of the data you want copied? If you can post an example data file, that could help.

  3. #3
    Registered User
    Join Date
    02-11-2013
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    58

    Re: filter and copy from excel into an e-mail (Body text).

    Hi Alphafrog,

    I have attached a sample data file, this only has three different number types in column G, however, there could be 90 different ones.

    The spread sheet attached contains the data I would get from a report containing 213 rows (this is only a small sample) This data I would like filter by column G,
    and then send the filtered rows or rows to different people.

    Please see the attached Jpeg's of the sample 3 e-mails.

    Regards

    Rob

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: filter and copy from excel into an e-mail (Body text).

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 06-26-2013 at 12:51 PM.

  5. #5
    Registered User
    Join Date
    02-11-2013
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    58

    Re: filter and copy from excel into an e-mail (Body text).

    Wow AlphaFrog, that is amazing.

    Thank you so much, this works perfectly.

    Rob

  6. #6
    Registered User
    Join Date
    02-11-2013
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    58

    Re: filter and copy from excel into an e-mail (Body text).

    Just one thing would it be possible if I could use the vaule in column G for the subect? I tried using
    Please Login or Register  to view this content.
    But this didn't seem to work
    Sorry for the extra question

    Rob
    Last edited by Robert110; 06-27-2013 at 08:55 AM.

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: filter and copy from excel into an e-mail (Body text).

    Quote Originally Posted by Robert110 View Post
    Just one thing would it be possible if I could use the vaule in column G for the subect? I tried using
    Please Login or Register  to view this content.
    But this didn't seem to work
    Sorry for the extra question

    Rob
    "didn't seem to work" is not a helpful description of the problem. Does it error, put the wrong value, does nothing?

    Try using just...
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-11-2013
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    58

    Re: filter and copy from excel into an e-mail (Body text).

    Sorry I should have explained further:-

    When I used
    Please Login or Register  to view this content.
    and debug is says G2 = empty.

    then I tried your suggestion:-

    Please Login or Register  to view this content.
    and when I debug, it says "Range(G2).Value = <Method 'Range' of object'_Global' failed>

    Rob

  9. #9
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: filter and copy from excel into an e-mail (Body text).

    Sorry. Missing the quotes around G2.

    .Subject = Range("G2").Value

  10. #10
    Registered User
    Join Date
    02-11-2013
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    58

    Re: filter and copy from excel into an e-mail (Body text).

    Great.

    This works perfectly.

    Thanks again for all your help

    Rob
    Last edited by Robert110; 07-08-2013 at 10:17 AM.

  11. #11
    Registered User
    Join Date
    02-11-2013
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    58

    Re: filter and copy from excel into an e-mail (Body text).

    Hey Alphafrog,

    Sorry to be a pain again, but could I ask one last question?

    The 'Lookup Email by ID in column H', would it be possible to move this.

    I have made a serperate tab called "E-mail ad" where all the email addresses are stored and updated, would it be possible to look up e-mail address from there?

    I tried adding 'Sheet (E-mail ad")' to the code, see below but it didn't seem to work

    Please Login or Register  to view this content.
    Sorry for the extra question, I didn't think of this until now

    Rob

  12. #12
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: filter and copy from excel into an e-mail (Body text).

    Please Login or Register  to view this content.

    Web search something like this: reference another sheet site:www.excelforum.com
    10 ways to reference Excel workbooks and sheets using VBA
    How to Reference Cells and Ranges [Excel 2003 VBA Language Reference]
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  13. #13
    Registered User
    Join Date
    02-11-2013
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    58

    Re: filter and copy from excel into an e-mail (Body text).

    Hi,

    Thanks I copied in the new code in, but the line below was highlighted in red

    Please Login or Register  to view this content.


    Then when I ran it, I got a "compile error: Sub or Function not defined" when I click ok, it highlights the 'Sheet' in the below code

    Please Login or Register  to view this content.
    Did I do something wrong?

    Rob

  14. #14
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: filter and copy from excel into an e-mail (Body text).

    No, I did. Apologies.

    It should be Sheets

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    02-11-2013
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    58

    Re: filter and copy from excel into an e-mail (Body text).

    Hi AlphaFrog,

    I can not thank you enough for all your help, this works perfectly

    Just for your inforation, I removed the extra ) in the below code. Just incase you needed to know

    Please Login or Register  to view this content.
    Thanks again

    Rob

+ 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