Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Macros for adjusting graphs every day

I have a number of reporting graphs linked into a spreadsheet which I update
on a daily basis. I then need to adjust where the graphs read to include the
days data. This is tedious and time consuming with 16 graphs to adjust. Is
there a macro or something I could write that would adjust the data range
automatically in excel97?Adjustment could be based on a date easily enough.

--
Jimmy
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 367
Default Macros for adjusting graphs every day

Did you try to do it with dynamic named ranges?
which adjust themselves according to todays date?

then you can tell excel, that the source data is not
in a fixed range but in your named range.

hth

Carlo

On Dec 3, 12:53 pm, Jimmy D wrote:
I have a number of reporting graphs linked into a spreadsheet which I update
on a daily basis. I then need to adjust where the graphs read to include the
days data. This is tedious and time consuming with 16 graphs to adjust. Is
there a macro or something I could write that would adjust the data range
automatically in excel97?Adjustment could be based on a date easily enough.

--
Jimmy


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6,582
Default Macros for adjusting graphs every day

Here are some examples of the technique Carlo is suggesting:

http://peltiertech.com/Excel/Charts/...umnChart1.html
http://peltiertech.com/Excel/Charts/Dynamics.html
http://peltiertech.com/Excel/Charts/...hartLinks.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"carlo" wrote in message
...
Did you try to do it with dynamic named ranges?
which adjust themselves according to todays date?

then you can tell excel, that the source data is not
in a fixed range but in your named range.

hth

Carlo

On Dec 3, 12:53 pm, Jimmy D wrote:
I have a number of reporting graphs linked into a spreadsheet which I
update
on a daily basis. I then need to adjust where the graphs read to include
the
days data. This is tedious and time consuming with 16 graphs to adjust.
Is
there a macro or something I could write that would adjust the data range
automatically in excel97?Adjustment could be based on a date easily
enough.

--
Jimmy




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Macros for adjusting graphs every day

had a look at the info suggested all looks good however I am still having
problems as I have more than 1 data series on the graph and all examples
presume no data in the cells following on from the last entry. This is not
the case for me.
Some insight:
I am using a copy/paste from MS project to produce 3 graph lines from the
same data. 1 line is planned work. Same line also produces Work carried out
(this is the one I want to adjust daily) third is forecast work (based on an
amount of work predicted to arise from known work and known work still to
carry out). First and third data sets are locked by pasting to separate
worksheets to the second data set.
--
Jimmy


"Jon Peltier" wrote:

Here are some examples of the technique Carlo is suggesting:

http://peltiertech.com/Excel/Charts/...umnChart1.html
http://peltiertech.com/Excel/Charts/Dynamics.html
http://peltiertech.com/Excel/Charts/...hartLinks.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"carlo" wrote in message
...
Did you try to do it with dynamic named ranges?
which adjust themselves according to todays date?

then you can tell excel, that the source data is not
in a fixed range but in your named range.

hth

Carlo

On Dec 3, 12:53 pm, Jimmy D wrote:
I have a number of reporting graphs linked into a spreadsheet which I
update
on a daily basis. I then need to adjust where the graphs read to include
the
days data. This is tedious and time consuming with 16 graphs to adjust.
Is
there a macro or something I could write that would adjust the data range
automatically in excel97?Adjustment could be based on a date easily
enough.

--
Jimmy





  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6,582
Default Macros for adjusting graphs every day

What I frequently suggest is that users put a copy of the data required for
charting into another range or another sheet. Use copy/paste link so the
data links to the original. Then you can reconfigure the chart source data
by dragging cells around until you have the arrangement you need. Worksheets
are very cheap, cells are very cheap, your time trying to avoid using sheets
and cells to your advantage is very costly and you will also avoid the
results you desire.

Spending five minutes with the data will prevent five hours of frustration.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Jimmy D" wrote in message
...
had a look at the info suggested all looks good however I am still having
problems as I have more than 1 data series on the graph and all examples
presume no data in the cells following on from the last entry. This is not
the case for me.
Some insight:
I am using a copy/paste from MS project to produce 3 graph lines from the
same data. 1 line is planned work. Same line also produces Work carried
out
(this is the one I want to adjust daily) third is forecast work (based on
an
amount of work predicted to arise from known work and known work still to
carry out). First and third data sets are locked by pasting to separate
worksheets to the second data set.
--
Jimmy


"Jon Peltier" wrote:

Here are some examples of the technique Carlo is suggesting:

http://peltiertech.com/Excel/Charts/...umnChart1.html
http://peltiertech.com/Excel/Charts/Dynamics.html
http://peltiertech.com/Excel/Charts/...hartLinks.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"carlo" wrote in message
...
Did you try to do it with dynamic named ranges?
which adjust themselves according to todays date?

then you can tell excel, that the source data is not
in a fixed range but in your named range.

hth

Carlo

On Dec 3, 12:53 pm, Jimmy D wrote:
I have a number of reporting graphs linked into a spreadsheet which I
update
on a daily basis. I then need to adjust where the graphs read to
include
the
days data. This is tedious and time consuming with 16 graphs to
adjust.
Is
there a macro or something I could write that would adjust the data
range
automatically in excel97?Adjustment could be based on a date easily
enough.

--
Jimmy








  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Macros for adjusting graphs every day

New fellow from work wrote a macro or 3 to do the job.

Sub Chart_Serie_Change()

Dim shChartSheet As Worksheet
Dim shDataSheet As Worksheet
Dim chChart As Object
Dim sSheetDataName As String
Dim i As Integer
Dim j As Integer

Set shChartSheet = Sheet6
Set shDataSheet = Sheet7

Set chChart = shChartSheet.ChartObjects
j = iColumn(shDataSheet)
sSheetDataName = shDataSheet.Name

If j = 1000 Then Exit Sub

'To change the chart
For Each chChart In shChartSheet.ChartObjects

i = iRow(shDataSheet, chChart)
If i = 1000 Then Exit Sub
shChartSheet.Activate
chChart.Activate
chChart.Chart.SeriesCollection(2).Values = "='" & sSheetDataName & "'!R"
& i & "C3:R" & i & "C" & j


Next chChart

MsgBox ("Charts have been updated")

End Sub

'To find the column the data needs to extend to
Function iColumn(shSheet As Worksheet) As Integer

iColumn = 3

With shSheet

Do While Year(.Range("A1").Cells(1, iColumn).Value) < Year(Now()) _
Or Month(.Range("A1").Cells(1, iColumn).Value) < Month(Now()) _
Or Day(.Range("A1").Cells(1, iColumn).Value) < Day(Now())

iColumn = iColumn + 1
If iColumn 250 Then
MsgBox ("Please, Check date in data source sheet")
iColumn = 1000
Exit Function
End If

Loop

End With

iColumn = iColumn - 1

End Function

'To find the row the chart refers to
Function iRow(shSheet As Worksheet, chChart_Obj As Object) As Integer

'I needed to start at row 6
iRow = 6
Dim sName As String

sName = chChart_Obj.Name

With shSheet
Do While .Range("B" & iRow).Value < sName

iRow = iRow + 7

If iRow 120 Then
MsgBox ("Please, check chart names in data source sheet")
iRow = 1000
Exit Function
End If

Loop

End With

End Function

It seems to work fairly well.
--
Jimmy


"Jimmy D" wrote:

I have a number of reporting graphs linked into a spreadsheet which I update
on a daily basis. I then need to adjust where the graphs read to include the
days data. This is tedious and time consuming with 16 graphs to adjust. Is
there a macro or something I could write that would adjust the data range
automatically in excel97?Adjustment could be based on a date easily enough.

--
Jimmy

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 Graphs & Macros Ken Excel Discussion (Misc queries) 4 October 3rd 07 01:24 PM
Adjusting series Sandy Charts and Charting in Excel 3 May 12th 07 06:30 PM
Adjusting the y axes on 2-axes line graphs aqua Charts and Charting in Excel 2 March 3rd 07 04:28 PM
Automatic Graphs/ Dynamic Graphs DanielWalters6 Charts and Charting in Excel 1 January 24th 06 09:29 PM
Excel Charts(Graphs) & Macros John Excel Discussion (Misc queries) 4 July 7th 05 09:26 PM


All times are GMT +1. The time now is 11:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"