Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Vicky,
if you want to try a VBA solution then something like following may do what you want. I have assumed that you have 3 charts on same worksheet & that sheet is named "Sheet1" You will need to correct this as required. Place cose in standard module - when run should update the sourcedata for each chart: Sub UpdateCharts() Dim lastcol As Integer Dim na As Integer Dim TheChartObj As ChartObject Dim TheChart As Chart Dim SourceData As Range Dim ws1 As Excel.Worksheet 'name of the worksheet where charts are stored 'change name as required Set ws1 = ThisWorkbook.Worksheets("Sheet1") '3 charts on same worksheet? For na = 1 To 3 Set TheChartObj = ws1.ChartObjects(na) Set TheChart = TheChartObj.Chart 'find last used column in row lastcol = ws1.Cells.Rows(na + 7).Find(What:="*", _ SearchDirection:=xlPrevious, _ SearchOrder:=xlByColumns).Column Set SourceData = ws1.Range(ws1.Cells(na + 7, 2), ws1.Cells(na + 7, lastcol)) 'update sourcedata TheChart.SetSourceData _ Source:=SourceData, _ PlotBy:=xlRows TheChartObj.Visible = True Set TheChartObj = Nothing Set TheChart = Nothing Next na End Sub -- jb "vicky" wrote: I know there have been earlier posts on this but I am new to VBA and i am finding it difficult to find a solution for this.... i have few charts in a sheet and its range is 1 ROW .BUT every month it keeps increasing by 1 column. i.e if the data range for a chart is $b$7:$cm $7 then next month it will be $b$7:$cn$7.... for all the charts in that sheet the data range will be increased by 1 column. month is on x axis . so charts have to get updated with every month ....... hope anyone can give a code snippet for this....... i.e data range for few graphs present in tat sheet from $b$8:$cm$8 .. it will change to $b$8:$cn$8 from $b$9:$cm$9 to it will change to $b$9:$cn$9 from $b$10:$cm$10 to it will change to $b$10:$cn$10 . |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Dynamically update label axis *format* without VBA? (03 and 07) | Charts and Charting in Excel | |||
Dynamically Scale X Axis on Column Chart Based on Number of Catego | Charts and Charting in Excel | |||
Y Axis : Dynamically Hardcode Min/Max Values? | Charts and Charting in Excel | |||
How do I dynamically end a charts X-axis on TODAY() | Charts and Charting in Excel | |||
dynamically changing chart y axis using spin buttons and worksheet_calculate event | Excel Programming |