Hello,
Very first post! To start off I am very bad at coding, in the past I always just try to find what I'm looking for posted somewhere then alter the code or add things together to make it work. This one has me stumped and I cant get it to work the way I want it, which is why I finally caved in and joined here (always seems to have the best answers).
Data and what I'm doing:
I download a large credit card data file that I then format and send individual pieces to the employees to submit an expense report. It takes way too long. I already created a macro that breaks down the data into individual worksheets for each person and includes a total. Now what I want to do is email that specific worksheet data pasted into the email body to the corresponding person. The macro I altered below works, but only on the whatever worksheet is active and I cannot get it to cycle/loop through all the worksheets. P.S. I am using Outlook.
Each worksheet looks like so:
<colgroup><col><col><col><col><col><col></colgroup><tbody>
</tbody>
My current code:
Sub Send_Range()
ActiveSheet.Range("F1").Select
ActiveSheet.Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Range(Selection, Selection.End(xlToLeft)).Select
ActiveSheet.Range(Selection, Selection.End(xlToLeft)).Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Introduction = "Below is all the transactional data from your credit card from 6/1/15 to 6/30/15."
.Item.To = ActiveSheet.Range("B2")
.Item.Subject = "June 2015 Expense Report"
.Item.Send
End With
End Sub
Very first post! To start off I am very bad at coding, in the past I always just try to find what I'm looking for posted somewhere then alter the code or add things together to make it work. This one has me stumped and I cant get it to work the way I want it, which is why I finally caved in and joined here (always seems to have the best answers).
Data and what I'm doing:
I download a large credit card data file that I then format and send individual pieces to the employees to submit an expense report. It takes way too long. I already created a macro that breaks down the data into individual worksheets for each person and includes a total. Now what I want to do is email that specific worksheet data pasted into the email body to the corresponding person. The macro I altered below works, but only on the whatever worksheet is active and I cannot get it to cycle/loop through all the worksheets. P.S. I am using Outlook.
Each worksheet looks like so:
Name | TRANS DATE | DESCRIPTION | AMOUNT | ||
DOE, JOHN D | test@text.co | 6/1/2015 | DEBIT | UNITED | -882.2 |
DOE, JOHN D | test@text.co | 6/2/2015 | DEBIT | HILTON HOTEL | -50 |
DOE, JOHN D | test@text.co | 6/3/2015 | DEBIT | UBER | -18.63 |
DOE, JOHN D | test@text.co | 6/4/2015 | DEBIT | UBER | -16.49 |
DOE, JOHN D | test@text.co | 6/5/2015 | DEBIT | GAS | -15.5 |
DOE, JOHN D | test@text.co | 6/6/2015 | DEBIT | DNC TRAVEL | -14.33 |
DOE, JOHN D | test@text.co | 6/8/2015 | DEBIT | MCDONALD'S | -11.45 |
DOE, JOHN D | test@text.co | 6/9/2015 | DEBIT | ANNUAL MEMBERSHIP FEE | -10 |
DOE, JOHN D | test@text.co | 6/12/2015 | DEBIT | FROZEN YOGURT | -3.24 |
DOE, JOHN D | test@text.co | 6/13/2015 | CREDIT | REVERSAL OF ANNUAL MEMBERSHIP FEE | 10 |
Total | -1011.84 |
<colgroup><col><col><col><col><col><col></colgroup><tbody>
</tbody>
My current code:
Sub Send_Range()
ActiveSheet.Range("F1").Select
ActiveSheet.Range(Selection, Selection.End(xlDown)).Select
ActiveSheet.Range(Selection, Selection.End(xlToLeft)).Select
ActiveSheet.Range(Selection, Selection.End(xlToLeft)).Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Introduction = "Below is all the transactional data from your credit card from 6/1/15 to 6/30/15."
.Item.To = ActiveSheet.Range("B2")
.Item.Subject = "June 2015 Expense Report"
.Item.Send
End With
End Sub