Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
This is the code I wish to use to create a bar chart and do specific things to it. However, it keeps aborting on "Chart 8" because the next time I use the macro, it becomes "Chart 9."
How would I add VBA code to make the chart number (and row number) increase each time I use the routine? Thanks Jeff Sub OATBarChart() ' ' OATBarChart Macro ' ' Range("E1:J2").Select ActiveSheet.Shapes.AddChart.Select ActiveChart.SetSourceData Source:=Range( _ "'OAT Test Charts Data_Crosstab'!$E$1:$J$2") ActiveChart.ChartType = xlColumnClustered ActiveChart.Legend.Select Selection.Delete ActiveSheet.ChartObjects("Chart 8").Activate ActiveChart.HasAxis(xlValue) = True ActiveSheet.ChartObjects("Chart 8").Activate ActiveChart.Axes(xlValue).Select ActiveChart.Axes(xlValue).MinimumScale = 0 ActiveChart.Axes(xlValue).MaximumScale = 1 ActiveChart.Axes(xlValue).MajorUnit = 0.1 ActiveChart.Axes(xlValue).MajorUnit = 0.2 Selection.TickLabels.NumberFormat = "0.00%" Selection.TickLabels.NumberFormat = "0%" ActiveSheet.ChartObjects("Chart 8").Activate ActiveChart.ChartArea.Select ActiveSheet.ChartObjects("Chart 8").Activate ActiveChart.SetElement (msoElementPrimaryValueAxisTitleVertical) ActiveChart.SetElement (msoElementChartTitleAboveChart) ActiveSheet.ChartObjects("Chart 8").Activate ActiveChart.ChartTitle.Text = "Adams County - 8th Grade Mathematics Results" ActiveSheet.ChartObjects("Chart 8").Activate ActiveChart.ChartArea.Select ActiveSheet.ChartObjects("Chart 8").Activate ActiveChart.Axes(xlValue).AxisTitle.Select ActiveSheet.ChartObjects("Chart 8").Activate End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Code to conditional format all black after date specified in code? | Excel Discussion (Misc queries) | |||
Drop Down/List w/Code and Definition, only code entered when selec | Excel Worksheet Functions | |||
Convert a Number Code to a Text Code | Excel Discussion (Misc queries) | |||
copying vba code to a standard code module | Excel Discussion (Misc queries) |