Send e-mail by Macro and let the range stop at the first empty (/blank) cell

tdruiter

New Member
Joined
Oct 6, 2014
Messages
3
Hello, I'm developing a new system for my organization. It's just a simple macro which will copy some information from Excel into a new e-mail. The range for copying is A68:E100. Therefore, sometimes there is no data in one of these cells, which means I want to stop the selection. My VBA as follows:
Rich (BB code):
Sub De_Nieuwe_Macro_03_10_14()
    Set mailApp = CreateObject("Outlook.Application")
    Set mail = mailApp.CreateItem(olMailItem)
    mail.Display
    Set wEditor = mailApp.ActiveInspector.wordEditor
    ActiveSheet.Range("A68:E100").Copy
    wEditor.Application.Selection.Paste
    With mail
        .Subject = Range("B66").Value
        .To = "Please fill in the right address"
        .Cc = myemail@address.com
        .Display
    End With
End Sub

And as you guys can see, everything is nearly arranged now. It's just that I don't want it to select empty cells and then the Macro is done. Hope anyone can help me out. Thanks in advance for your effort. Best regards, Tom
 
Last edited by a moderator:

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Check the range then send it if needed...

Code:
If WorksheetFunction.CountA(Range("A1:D10")) = 0 Then
MsgBox "DO NOT SEND"
Else
MsgBox "SEND"
End If
 
Upvote 0
Thanks a lot for your reply. I don't want Excel to send Messages but I want it to stop copying (into Outlook) until the first empty cells is reached. Awaiting your reply and thanks a lot for your effort.
 
Upvote 0
Anyone known with this problem? Hope someone can help me out on this matter. It's still pending. Thanks in advance.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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