Copying a range and pasting into email

dude0216

New Member
Joined
Nov 28, 2005
Messages
11
I am trying to look at dates in a column. If the date in column G is equal to today plus 7 days, I want to copy the entire row (Cells A thru J) and paste it into a email. After looking at the entire column and extracting the information I need, I then want to send the email.

Below is the code I have so far, the two problems I have are, I can not copy and paste the selected row, and I am unsure on how to loop thru the entire column looking at the dates before I send the email.

Sub Macro1()
Dim olApp As Outlook.Application
Dim olMail As MailItem
Range("G2").Select
Do Until ActiveCell.Value = "stop"
If ActiveCell.Value = Date + 7 Then
ActiveCell.Offset(0, -6).Range("A1:K1").Select
'Selection.Copy

Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)
With olMail
'Change email address here **********************************
.To = "myemailaddress.com here"
.Subject = ""
'Change name ****************
.Body = Range("A1:K1").Value

.Send 'Or use Display
Set olMail = Nothing
End With
Set olApp = Nothing
Application.ScreenUpdating = True
'Do Until ActiveCell.Value = "stop"
'ActiveCell.Offset(0, 0).Range("G2").Select
ActiveCell.Offset(1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,021
Messages
5,834,992
Members
430,331
Latest member
Syed Yasir Hannan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top