• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Sending Multiple Ranges via Email

Hey guys,

I have previous macros set up to send a range of my active sheet via excel, which is the basic coding below:
Code:
Sub Send_Range()

  ' Select the range of cells on the active worksheet.
  ActiveSheet.Range("A1:K39").Select

  ' Show the envelope on the ActiveWorkbook.
  ActiveWorkbook.EnvelopeVisible = True

  ' Set the optional introduction field thats adds
  ' some header text to the email body. It also sets
  ' the To and Subject lines. Finally the message
  ' is sent.
  With ActiveSheet.MailEnvelope
  .Introduction = "######"
  .Item.To = "#####"
  .Item.Subject = "######"
  .Item.Send
  End With
End Sub
What I need this new one to do is send multiple ranges from the active sheet, which will send in the body of the email below each other.

For example I need to send ranges A1:K39 & also A40:K52, but obviously ignore the cells inbetween the two ranges.

Is this possible using my code above?

I'm a newbie, and my knowledge is very basic.

Thanks.
 
Last edited by a moderator:
Hi,

I have looked through that page & can't seem to find what I need it to do.

I have attached an example file with my macro.

You can see its currently set to send A1:J36

What I need it to do is send range A1:J8 and then also A21:J36 so it misses out everything between A9 and J20.

They need to be sent into the body of the email with one range under the other.

Thanks.
 

Attachments

Welcome to the forum!

I think that only lets you send the whole sheet. You can select discontinuous ranges:
Code:
' Select the range of cells on the active worksheet.
Range("A1:K39, A40:K52").Select
 
Last edited:
Welcome to the forum!

I think that only lets you send the whole sheet. You can select discontinuous ranges:
Code:
' Select the range of cells on the active worksheet.
Range("A1:K39, A40:K52").Select

I have tried this before, it doesn't work it just sends the whole of the worksheet, even though I can see it selecting the relevant cells on the worksheet.
 
Yes, use outlook as suggested. Use the rangetohtml routine in that link.

I use director method but the htmlbody method that is in the link is simple for most.
 
Back
Top