View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Daniel.C[_2_] Daniel.C[_2_] is offline
external usenet poster
 
Posts: 105
Default Macro to email filtered section as attachment

Hi,
Try the following macro :

Sub test()
Dim c As Range, myRange As Range
Set myRange = Range("_filterdatabase").Offset(1)
Set myRange = myRange.Resize(myRange.Rows.Count - 1, 1).Offset(, 1)
Set myRange = myRange.SpecialCells(xlCellTypeVisible)
Workbooks.Add 1
Set wb = ActiveWorkbook
With ThisWorkbook.Sheets("Sheet1")
For Each c In myRange
Range(.Cells(c.Row, 1), .Cells(c.Row, 256).End(xlToLeft)).Copy
wb.ActiveSheet.Paste
wb.SendMail c.Value & ", "Subject"
Next c
End With
wb.Close False
End Sub

The file I tested with is at the following address :

http://www.filedropper.com/tamara

Regards.
Daniel

Hi, I would appreciate some assistance with a spreadsheet I need to email to
specific users.
I have a master sheet which details in the first column the State, 2nd
column the managers name, following columns store details and other
information. What I require is a macro to email each manager with their
filtered information. I've successfully used Ron de Bruines "Mail a row or
rows to each person in a range" to do this function (email addy's in a
separate page) but it inbeds the spreadsheet in the email and I require it to
be an attachment. I found a macro to save the managers info in separate
files but was unable to merge this function with an email function within the
same macro. Any help would be much appreciated!!!