I'm currently in the middle of a project to create chart reports for multiple users.
Upon pressing a macro button, what I'd like it to do is the following:
- Create a chart
- Change the chart title
- Export the chart as an image
With the code I have, to change the chart title I need to input the chart number, but upon creating a chart it's assigned it's own number. Is there any way I can change the code so that it picks up the number of the most recently generated chart?
Here's the chart rename code:
I also have code for identifying the number of the chart, could this be used in some way?
Thanks in advance for any help.
Upon pressing a macro button, what I'd like it to do is the following:
- Create a chart
- Change the chart title
- Export the chart as an image
With the code I have, to change the chart title I need to input the chart number, but upon creating a chart it's assigned it's own number. Is there any way I can change the code so that it picks up the number of the most recently generated chart?
Here's the chart rename code:
Code:
ActiveSheet.ChartObjects("Chart ##").Activate
ActiveChart.ChartArea.Select
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = Range("a44").Value & " Conversion Rate"
I also have code for identifying the number of the chart, could this be used in some way?
Code:
Sub IdentifyChart()
Dim chtObject As ChartObject
For Each chtObject In ActiveSheet.ChartObjects
MsgBox chtObject.Name
Next
End Sub
Thanks in advance for any help.