ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   dynamic charts problem (https://www.excelbanter.com/excel-discussion-misc-queries/151322-dynamic-charts-problem.html)

ali

dynamic charts problem
 
hi guys

I have a problem with dynamic charting. I am able to create a dynamic
chart using vba one time. But it doesn't get updated. When the macro
runs a new chart is created every time or I come across an
application
error. I would like to have the following chart with name "mychart"
and I would like to keep updating it. Here is the code that I have
got.


Dim colcount As Integer
colcount = Cells(Rows.Count, 2).End(xlUp).Row
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData
Source:=Sheets("DesignGraph").Range(Cells(2, 2), Cells(colcount, 2)),
_
PlotBy:=xlColumns
ActiveChart.Location Whe=xlLocationAsObject,
Name:="DesignGraph"
With Selection.Border
.Weight = 2
.LineStyle = -1
End With
Sheets("DesignGraph").DrawingObjects("Chart 53").RoundedCorners =
False
Sheets("DesignGraph").DrawingObjects("Chart 53").Shadow = False
Selection.Fill.OneColorGradient Style:=msoGradientHorizontal,
Variant:=3, _
Degree:=0.231372549019608
With Selection
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 5
End With
ActiveChart.PlotArea.Select
With Selection.Border
.ColorIndex = 16
.Weight = xlThin
.LineStyle = xlContinuous
End With
Selection.Fill.OneColorGradient Style:=msoGradientHorizontal,
Variant:=1, _
Degree:=0.231372549019608
With Selection
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 39
End With


Thanks a lot.


ali



All times are GMT +1. The time now is 06:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com