Using Macro to copy latest data from one Workbook to another

K

Kayote

Guys,

Heres the intro...

What Im THINKING of doing is creating a workbook that will only hav
graphs so those people in the management who dont feel comfortable wit
figures can grasp the basic info just by looking at the graphs...

What I donot want to do is update the graph workbook everyday as i
takes its data from quite a few other workbooks. What Im thinking of i
that I would have a macro that would copy the latest date's figures fro
each sheet in the workbooks and paste them in the graph workbook.

So any ideas how should I go about doing this... I cant think of an
command that would let me do this, looping would start from first dat
(in the data files) but that would ruin my spreadsheet as my grap
report doesnt take into account all the last couple of years dates...

Please advise.

cheer
 
G

Guest

If your graphs already exist

Sub BuildChartBook()
Dim bk as Workbook, sh1 as worksheet
Dim sh as worksheet, rw as Long
Dim cht as ChartObject
set bk = Workbooks("Chart.xls")
set sh1 = bk.Worksheets(1)
rw = 5
for each sh in Workbooks("GraphMaster.xls").Worksheets
for each cht in sh.chartObjects
cht.copypicture
bk.Activate
sh1.Activate
sh1.Cells(rw,2).Select
sh1.Paste
rw = rw + 20
Next
Next
End Sub

If you want to manipulate the graphs, turn on the macro recorder while you
do it manually, then turn off the macro recorder and look at the recorded
code. then generalize the code and combine it with some form of the first
macro.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top