Compu Geek;715770 Wrote:
I have yearly data for multiple countries stored in an Access database.
I
have an Excel chart template that I import the data into to view each
country's yearly data as needed.
I need a macro to import the data for multiple countries at one time,
create
an updated chart for each country, and then print all the country charts
into
one PDF file.
Currently, I have a worksheet in my Excel workbook that I use to type
which
ever countries I want to view in separate charts based off of the
template
chart.
You could use the following as a starting point to have all your
templates in one workbook - this is the only way I can think of to print
to one pdf. (There are utilities available to combine several pdfs to
one, though.)
VBA Code:
--------------------
Dim country(1 To 10) As String, i As Integer
country(1) = "USA"
' define all the countries you need....
Workbooks.Add
For i = 1 To UBound(country())
Sheets.Add Type:="your_template_name.xlt", Befo=Sheets(Sheets.Count)
ActiveSheet.Name = country(i)
' here get the data in place for country(i)
' e.g.
Range("country_name").Value = country(i)
Range("data_set").QueryTable.Refresh
Next
--------------------
--
Zeq
------------------------------------------------------------------------
Zeq's Profile:
http://www.thecodecage.com/forumz/member.php?u=1626
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=200375
http://www.thecodecage.com/forumz