K
kwedde01
When I record a chart macro and then run it, it gives an error message
on th eline Charts.Add, when the workbook is locked. How can i get
around this without manually unprotecting the workbook. Also when run
it produces a new sheet called Chart1. I do not want to create a new
sheet with the chart, but rather have it appear on the screen where the
data tables are.
Finally is there a way for me to create a user form, which has 3
different options for different charts, taken from different data, and
when each is selected the corresponding chart is diplayed on the user
form, or in the window.
This is the code for one chart so far, this generates the error
mentioned above:
Sub Chart2()
'
Range("A5:C12").Select
Charts.Add
ActiveChart.ChartType = xl3DBarClustered
ActiveChart.SetSourceData Source:=Sheets("BRANCH TOTAL CURRENT v
PREVIOUS"). _
Range("A5:C12"), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart
..HasTitle = True
..ChartTitle.Characters.Text = _
"Total Branch Scores-Current vs Previous (In-Branch)"
..Axes(xlCategory).HasTitle = True
..Axes(xlCategory).AxisTitle.Characters.Text = "Branch"
..Axes(xlSeries).HasTitle = False
..Axes(xlValue).HasTitle = True
..Axes(xlValue).AxisTitle.Characters.Text = "Indexed Scores"
End With
End Sub
Any help would be appreciated
on th eline Charts.Add, when the workbook is locked. How can i get
around this without manually unprotecting the workbook. Also when run
it produces a new sheet called Chart1. I do not want to create a new
sheet with the chart, but rather have it appear on the screen where the
data tables are.
Finally is there a way for me to create a user form, which has 3
different options for different charts, taken from different data, and
when each is selected the corresponding chart is diplayed on the user
form, or in the window.
This is the code for one chart so far, this generates the error
mentioned above:
Sub Chart2()
'
Range("A5:C12").Select
Charts.Add
ActiveChart.ChartType = xl3DBarClustered
ActiveChart.SetSourceData Source:=Sheets("BRANCH TOTAL CURRENT v
PREVIOUS"). _
Range("A5:C12"), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart
..HasTitle = True
..ChartTitle.Characters.Text = _
"Total Branch Scores-Current vs Previous (In-Branch)"
..Axes(xlCategory).HasTitle = True
..Axes(xlCategory).AxisTitle.Characters.Text = "Branch"
..Axes(xlSeries).HasTitle = False
..Axes(xlValue).HasTitle = True
..Axes(xlValue).AxisTitle.Characters.Text = "Indexed Scores"
End With
End Sub
Any help would be appreciated