Macro Sort/filter and create new files automatic

netfrk

New Member
Joined
Jun 13, 2014
Messages
2
Hello,

I need HELP to automate a monthly recurrent task. (excel 2007)
Create "invoice like" PDF's based on table in one sheet.

Rows 1-6 are "Logo, headers & Cells with Sum of filtered data"

DATA to Filter is in Table A7:F xxxxx (normally has not more than 100.000 rows/lines)

Header Columns on row 6 are:
Name > Date/Time > Number > Destination > Duration > Cost (are phone call data)

Until now I have the part that creates the pdf file automatically on the desired folder.
Sub Macro2()
'
' Macro2 Macro
'
' Keyboard Shortcut: Ctrl+q
'
ChDrive "C"
ChDir "C:\Users\ABC\My Documents\2014\Invoice PDF"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=("MAY ") & Range("A7").Value & (" CallList")

End Sub


Now I need help to filter and automate each client ( "name" Column).

So you can better understand:
Table is sorted by data/time. So I need macro to:
1st - sort/autofilter alphabetically (A-Z) each name + run macro2 (above) and then
2nd - sort/autofilter next name alphabetically + run macro2… and so on until it reaches the last name (some months 150 others 250)

Until now my manual process is:
1- Apply auto filter on row6 (name) and select 1 name
This returns an x number of rows (depending on how many calls client made and also returns total cost of the month for this client on cell F3 (=SUBTOTAL(9;F7:1000000) formula.
2- Then save as… pdf.
3- Select next client on autofilter … save as PDF … …
This goes on about 200 times because call list has about 200 clients each month

So what I need is the first part of the macro.

Anyone, any ideas?

Thank you so much.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Just came arround that my macro (save as pdf, filename has a bug)
When I say "A7" Filename:=("MAY ") & Range("A7").Value & (" CallList") it always returns the name on cell "A7" and not the name selected by AutoFilter ...

I apreciate your help.
 
Upvote 0

Forum statistics

Threads
1,215,575
Messages
6,125,629
Members
449,241
Latest member
NoniJ

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