+ Reply to Thread
Results 1 to 6 of 6

Macro to email range instead of the whole sheet

  1. #1
    Forum Contributor
    Join Date
    07-16-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    176

    Macro to email range instead of the whole sheet

    The codes below works perfectly, but when I un-comment 'range("a1:c6").select, the macro goes crazy and go into a continuous loop. I only want to send range a1:a6 as body instead of the whole sheet.


    Please Login or Register  to view this content.
    Last edited by igoodable; 07-20-2016 at 05:32 PM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,317

    Re: Macro to email range instead of the whole sheet

    Try Ron's email page
    HTH
    Regards, Jeff

  3. #3
    Forum Contributor
    Join Date
    07-16-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    176

    Re: Macro to email range instead of the whole sheet

    I need help understanding the error please... More specifically, why does defining a range breaks the program?

  4. #4
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Macro to email range instead of the whole sheet

    Hi..

    I would be going with SNB's version of sending a contiguous range in email..

    http://www.snb-vba.eu/VBA_Excelgegev...len_en.html#L4

    It can be adapted to send non-contiguous ranges too..

  5. #5
    Forum Contributor
    Join Date
    07-16-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    176

    Re: Macro to email range instead of the whole sheet

    I'm not really looking for a solution. I'm interested in learning vba on a deeper level. In this case, I want to know why defining a range cause the program to crash. It cause outlook and excel to into a continuous loop.

    If I manually select a range before executing the macro, it works, but I can't programmatically select a range.

  6. #6
    Forum Contributor
    Join Date
    07-16-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2013
    Posts
    176

    Re: Macro to email range instead of the whole sheet

    I'm more boggled that if I do range a1:b6, it works fine!! Column C is just ordinary values, nothing special or different about the rest of the columns. SOMEONE HALLPP!!!

    Sample file attached.

    If I change Set Sendrng = Worksheets("lagg").Range("A1:b" & rangea) to Set Sendrng = Worksheets("lagg").Range("A1:C" & rangea), excel will go crazy.
    Attached Files Attached Files
    Last edited by igoodable; 07-21-2016 at 11:57 AM.

+ 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. Macro vba auto email runtime error when having difrent sheet to name range sheet open
    By no1freeman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-18-2015, 01:35 AM
  2. Macro to attach range to email in new sheet but not send?
    By Serafin54 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-22-2014, 01:07 PM
  3. [SOLVED] Email specific Range using macro
    By shaileshgavanang in forum Excel General
    Replies: 6
    Last Post: 02-23-2014, 10:19 AM
  4. Email Macro - From excel sheet to Outlook email macro
    By juanes in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-30-2013, 01:59 PM
  5. VBA to email to addresses in range on another sheet
    By tweitzel79 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-24-2013, 11:20 AM
  6. Macro to PDF a sheet in workbook and email (outlook) to an email address in a cell
    By paul_sykes00 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-17-2012, 12:54 AM
  7. Email Range on one sheet
    By plumbing contractor in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-04-2009, 12:32 PM

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