Pulling an email address from a cell using Offset

mnmhenry

Board Regular
Joined
Mar 28, 2002
Messages
169
Greetings everyone,

I'm hoping someone can help me here. I'm trying to send an email from excel but I want to pull the email out of a cell that is 6 columns to the right of the active cell.

I can make it run ok when I'm using range (.to = Sheets("Quote Register").Range("J11")) but having issues with offset. (Coloured blue)

Sub Sent_Test_Email()
On Error GoTo ErrHandler

' SET Outlook APPLICATION OBJECT.

Dim objOutlook As Object
Set objOutlook = CreateObject("Outlook.Application")

' CREATE EMAIL OBJECT.
Dim objEmail As Object
Set objEmail = objOutlook.CreateItem(olMailItem)

With objEmail
'.to = "slave@resolve.net.au"
'.to = Sheets("Quote Register").Range("J11")

.to = Sheets("Quote Register").ActiveCell.Offset(7, 0)
.Subject = Sheets("Quote Register").Range("K11")
.Body = Sheets("Quote Register").Range("L11")
.Display ' Display the message in Outlook.
End With

' CLEAR.
Set objEmail = Nothing: Set objOutlook = Nothing

ErrHandler:
'
End Sub

Thanks for any help.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
ActiveCell is not a Sheet property, so your syntax is not correct.

Try:

VBA Code:
.to = ActiveCell.Offset(, 6).Value
 
Upvote 0
Solution

Forum statistics

Threads
1,214,987
Messages
6,122,613
Members
449,090
Latest member
vivek chauhan

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