Filtered Results to email

Alphacsulb

Active Member
Joined
Mar 20, 2008
Messages
414
I came across this VBA post that allows me to create an email and BCC a list of emails, however I want to gather the visible filtered list, and not everything that is within the range.

I'm unsure where SpecialCells(xlCellTypeVisible) would apply. Any assistance would be appreciated:

Code:
Sub CreateEmail()


Dim oMSOutlook As Object
Dim oEmail As Object
Set oMSOutlook = CreateObject("Outlook.Application")
Set oEmail = oMSOutlook.CreateItem(olMailItem)


With oEmail


 For i = 2 To Application.WorksheetFunction.CountA(Columns(4)) '2 Skips header, Column 4 applies to Column D
 .Recipients.Add(Cells(i, 4).Value).Type (3)   ' Type 1 (To), Type 2 (CC), Type 3 (BCC) 


 Next i


.Display 'Displays the email before it gets sent
End With


Set oMSOutlook = Nothing
Set oEmail = Nothing


End Sub

:eeek:
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try with this variant:
Code:
For I = 2 To .....
    If Rows(I).Hidden = False Then
        .Recipients.Add(Cells(I, 4).Value).Type (3)
    End If
Next I
Bye
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,334
Members
452,636
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