I am hoping you could help me, I want to filter a worksheet on the name of a supplier(column C) and on todays date (Column T) and then email them columns C:T from that filtered information could anyone help?
Do you want to send mail by outlook?
Do you want to generate a file with the filtered information and send the file?
What name will the file have?
What is the subject?
What is the body of the mail?
In which row are your headings?
In which row do your data start?
Do you want the headings in the file?
You could put an example of how your data is on the sheet.
That is, on the sheet you have several suppliers and you want a file for each supplier?
I attached an advance so you can start testing.
Dim wb As Workbook, sh As Worksheet, c As Range, m As Range
Dim sBody As String, wFile As String
Dim dam As Object, dict As Object
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set sh = ActiveSheet
Set dict = CreateObject("scripting.dictionary")
If sh.AutoFilterMode Then sh.AutoFilterMode = False
sh.Range("A1").AutoFilter Field:=20, Criteria1:=xlFilterToday, Operator:=xlFilterDynamic
For Each c In sh.Range("C2", sh.Range("C" & Rows.Count).End(xlUp)).SpecialCells(xlCellTypeVisible)
If Not dict.exists(c.Value) Then
dict(c.Value) = dict(c.Value)
sh.Range("A1").AutoFilter 3, c
Set wb = Workbooks.Add
wFile = ThisWorkbook.Path & "\" & Format(Date, "dd-mm-yyyy") & " " & c.Value & ".xlsx"
Set dam = CreateObject("Outlook.Application").CreateItem(0)
dam.To = "[COLOR=#ff0000]firstname.lastname@example.org[/COLOR]"
dam.Subject = [COLOR=#ff0000]"Subject ?????[/COLOR]"
dam.Body = "[COLOR=#ff0000]Hi XXX, Please see attached. Regards XXX[/COLOR]"
dam.Display 'use .Send to send
MsgBox "Emails sent"
Do you have data with today's date?
Can you put a sample of your data?
You could upload a copy of your file to a free site such www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. If the workbook contains confidential information, you could replace it with generic data.