dear all
I have recorded a macro which basically just creates a chart in a standard style and resizes it to a uniform size. Here is a section of the code:
My problem is that the code refers to a specific chart (chart 18), and therefore will only work if the chart is called 'chart18'. Could anybody adjust the syntax so that it resizes the chart to the same dimensions, but with whichever chart happens to be selected at the time.
I had a couple of guesses at what the syntax might be, but didn't get it!
Thanks in advance for your help
Rich
I have recorded a macro which basically just creates a chart in a standard style and resizes it to a uniform size. Here is a section of the code:
Code:
ActiveChart.ChartArea.Select
ActiveSheet.Shapes("Chart 18").IncrementLeft -179.25
ActiveSheet.Shapes("Chart 18").IncrementTop 50.25
ActiveChart.ChartArea.Select
ActiveSheet.Shapes("Chart 18").ScaleWidth 0.7, msoFalse, msoScaleFromTopLeft
ActiveSheet.Shapes("Chart 18").ScaleHeight 0.71, msoFalse, msoScaleFromTopLeft
ActiveChart.Axes(xlValue).Select
My problem is that the code refers to a specific chart (chart 18), and therefore will only work if the chart is called 'chart18'. Could anybody adjust the syntax so that it resizes the chart to the same dimensions, but with whichever chart happens to be selected at the time.
I had a couple of guesses at what the syntax might be, but didn't get it!
Thanks in advance for your help
Rich