Forum Discussion
Excel recorded macro to VBA to call from a different software
Sorry I must have forgot to attach the workbook. See previous post. You have to rename the charts for it to work properly. Select the chart then change the name in the upper left hand corner. They need to be in the order the sheets are in...
- junsh.graceJun 29, 2018Copper ContributorSorry to bother you again Matt. I tried running the macro on a different computer to see if there was something wrong with my workstation but ended up with the same error. Wouldn't you incorporate chart naming in the macro? I suppose the error message is prompted because there are no chart name "myCht1", "myCht2", etc. Did you name your chart manually before running the macro? Another question: why did you comment out the first line after the for loop line? 'ActiveSheet.Shapes.Range("myCht" & intLp + 1).Select Thanks! Junsh
- Matt MickleJun 29, 2018Bronze Contributor
I did name them manually before hand. I wasn't sure if you had more than one chart on each worksheet. So I wanted to make sure I could name them based on an easy convention. This also prevents the need to cycle through all of the shapes in the workbook looking for the chart.
The line I commented out was done so because it serves no purpose. I was fiddling around testing how to work with charts, because it's been a while and during the testing I determined this wasn't necessary.
I could incorporate naming the chart in the file you are correct. I just wanted the most direct way to access the chart objects without having to cycle thorough any others....
- junsh.graceJul 03, 2018Copper Contributor
By the way, I greatly appreciate all your help and time. It's been quite challenging for someone like me without much knowledge about EXCEL macro and its intricacies.