Reference a cell in email title

O177812

Board Regular
Joined
Apr 16, 2015
Messages
94
Office Version
  1. 365
  2. 2021
I am usingthe below:

Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
Set rng = Selection.SpecialCells(xlCellTypeVisible)
Set rng = Sheets("BY SKU").Range("B2:F11").SpecialCells(xlCellTypeVisible)
On Error Resume Next
With OutMail
.To = "kremaley@inw-group.com; kristin@proformlabs.com; cory@proformlabs.com; orders@proformlabs.com"
.Cc = "sboatright@proformlabs.com; shippingshared@proformlabs.com; garvizu@inw-group.com"
.Subject = "Walmart Orders: Orders Created " & Format(Now, "mm-dd-yyyy") & " for ship " & Format(Now + 7, "mm-dd-yyyy")
.HTMLBody = "Hi Team, " & Chr(10) & "<br>" & "<br>" & _
Chr(10) & "Here are the orders that came in today that are scheduled to ship on " & Format(Now + 7, "mm-dd-yyyy") & Chr(10) & Chr(10) & RangetoHTML(rng) & "<br>" & _
Chr(10) & "Have a great week!"
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
On Error GoTo 0
Set OutMail = Nothing


I want to replace the highlighted to use a selected cell (Cell C7 on a worksheet titled "BY DC")

Please help :-(
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Perhaps ... & Sheets("BY DC").Range("C7") & Chr(10) & Chr(10)
However, not sure if you need to worry about why the cell is selected when you can just refer to it by its address. Or did you mean to use a value from the active/selected cell regardless of which that is?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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
Back
Top