+ Reply to Thread
Results 1 to 7 of 7

Emailing User Defined Ranges

  1. #1
    Forum Contributor
    Join Date
    09-14-2016
    Location
    Fareham UK
    MS-Off Ver
    2010
    Posts
    110

    Emailing User Defined Ranges

    Hi Guys, I hope you are all well today

    I was wondering if anyone could help me with the below. I am trying to use the below code to email user defined ranges(the name of the range is shown as a value in first cell, the emaill address is in the 2nd with information below). on sheet 2 of a workbook. but every time I run the macro it errors with :

    Compile Error:

    Loop Without Do.

    Please Login or Register  to view this content.
    any help would be greatly appreciated

    Many thanks

    jamie
    Last edited by bloodmilksky; 11-02-2016 at 09:36 AM. Reason: CODE ENTERED WRONG

  2. #2
    Forum Contributor
    Join Date
    08-09-2012
    Location
    British Columbia
    MS-Off Ver
    Excel 2010
    Posts
    190

    Re: Emailing User Defined Ranges

    You have 3 With and only 2 End With

  3. #3
    Forum Contributor S O's Avatar
    Join Date
    06-25-2015
    Location
    England
    MS-Off Ver
    Office 2010 + 2013 + 2016
    Posts
    103

    Re: Emailing User Defined Ranges

    You need to change [\CODE] to [/CODE] to format your code correctly btw.

  4. #4
    Forum Contributor
    Join Date
    09-14-2016
    Location
    Fareham UK
    MS-Off Ver
    2010
    Posts
    110

    Re: Emailing User Defined Ranges

    I have amended it and it is still erroring on the same Compile error

  5. #5
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Emailing User Defined Ranges

    well, i made three small changes to the code and it works like you wanted. got rid of the customerMail and substituted my email address. then i added the third end with statement. and i commented out the .rg.Parent.Activate statement. so here it is.

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    09-14-2016
    Location
    Fareham UK
    MS-Off Ver
    2010
    Posts
    110

    Re: Emailing User Defined Ranges

    Its still erroring and i have removed all of the other macros from the work book to ensure there isnt anything causing it to error. I think i am at a loss.

  7. #7
    Valued Forum Contributor dmcgov's Avatar
    Join Date
    11-11-2015
    Location
    Florida, USA
    MS-Off Ver
    Office 365 Business
    Posts
    1,518

    Re: Emailing User Defined Ranges

    so im attaching a simple spreadsheet with data in it (different from yours). Check to see that it works (don't forget to edit the macro and change the email address). if it works on your machine then the issue is with your initial sheet.

    let me know how you progress.

    email ranges.png

    this is the image of the range that i am using to email (and it works like you want it to)
    Attached Files Attached Files

+ 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. Replies: 4
    Last Post: 06-28-2016, 05:38 PM
  2. [SOLVED] Cut and Paste with User Defined Ranges in a macro
    By ehope10 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2015, 11:12 AM
  3. duplicates - user defined ranges - need help!
    By banks334 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-19-2014, 07:21 PM
  4. Combine VLOOKUP and SUMIF to return sum of user-defined ranges in a table
    By sciondraconis in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-27-2014, 03:27 AM
  5. Replies: 0
    Last Post: 11-19-2012, 10:41 AM
  6. User Defined Functions: can control what named ranges get used?
    By djt76010 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-21-2008, 08:26 PM
  7. [SOLVED] Retaining user-defined chart settings when emailing document
    By hogon in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-28-2005, 05:06 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