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

:eek:
 

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.
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,214,861
Messages
6,121,969
Members
449,059
Latest member
oculus

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