Vba Activate Chart Fails

Vba Activate Chart Fails Rating: 5,6/10 2915votes

I have noticed that VBA stops to execute when a chart is activated on the sheet. How to go around this problem In my routine Im handling charts with new series and. Vba Activate Chart Fails' title='Vba Activate Chart Fails' />Chart. Visual Basic for Applications. I have a Excel VBA application which has been working fine in Excel 2003 but failed in Excel 2010. The relative codes are Public Sub CreateChart Dim c Dim. Before I begin, here is some history Created VBA in Excel to open and read three 3 Excel files includes itself and input data into chartstablesgraphs into a. I wrote a whole bunch of really cool chart macro to help me adjust about 120 charts each time I have to update a bunch of reports. Chart deactivate. LinkAxisToCells-DataChart2.png' alt='Vba Open Workbook And Activate' title='Vba Open Workbook And Activate' />Vba Activate Chart FailsVba Activate Chart FailsChart Activate Problem PC Review. Tema Naruto Windows 7 Ultimate. Re Two Buttons, Same Chart Selects. Phil And youve changed. With Active. Sheet. Chart. ObjectsChart 1. With Active. Sheet. Chart. ObjectsChart 1. If so, I cant think of a reason this would happen. Jon Jon Peltier, Microsoft Excel MVPhttp www. Excelindex. htmlPhil Hageman wrote Jon, You are correct all worksheets in this workbook are protected. I changed the code to exactly as you have here. Worksheet Metrics does come up, with the cursor in A1. There are two buttons with the exact same macro code the difference being the macro names Go. To. Metric. 1 and Go. To. Metric. 2 and the chart names Chart 1. Chart 1. 7 chart names are correct. Regardless of which Button is clicked the same chart is selected. Where am I going wrong Thanks, Phil Original Message Phil I get that error message if the parent worksheet is protected. You dont need to select the chart to resize it. This works whether or not the sheet is protected Sub Go. To. Metric. 1 SheetsMetrics. Select RangeA1. Select With Active. Sheet. Chart. ObjectsChart 1. Height 6. 60. Width 7. Top 1. 0. Left 1. End With End Sub Jon Jon Peltier, Microsoft Excel MVP http www. Excelindex. html Phil Hageman wrote On a worksheet named Customer, is a Button among other buttons with a macro named Go. To. Metric. 1 assigned to it. The macro code is located in Module. Barry Finnerty New York City Rare'>Barry Finnerty New York City Rare. Sub Go. To. Metric. SheetsMetrics. Select RangeA1. Select Active. Sheet. Chart. ObjectsChart 1. Activate With Active. Chart. Parent. Height 6. Width 7. 80. Top 1. Left 1. 25 End With End Sub On the worksheet named Metrics, are various charts, with Chart 1. The intent is when the user clicks on the Button, Chart 1. Metrics worksheet comes up, and the cursor locates in A1 however, Im getting a run time error 1. Activate method of Chart. Object class failed. The line Active. Sheet. Further confusing this is the fact that sometimes this run time error does not occur. Can someone help me correct this error There is also an Auto Open routine being run when the workbook opens, located in Module. I dont think there is a conflict with it, but the code is Sub AutoOpen Application. Screen. Updating False Application. Display. Full. Screen True For Each ws In Worksheets If ws. Visible xl. Sheet. Visible Then ws. Select Application. Go. To ws. RangeA1, True Active. Window. Display. Gridlines False End If Next WorksheetsScorecard. Select This. Workbook. Colors7 RGB2. Application. Auto. Percent. Entry True Application. Screen. Updating True End Sub. Activating a chart object in VBA. In the past, the code generated a chart called chart onto an Excel chart sheet,and then later in the program activated the chart to populate it with data entered by the user as follows. ChartsChart. Activate. With xl. Active. Chart. Set. Source. Data Source xlra. All, Plot. By xl. Rows. However, I had to change this to generating a chart object on a worksheet, but when I try the following code to activate the chart to feed it data, Im getting a type mismatch   WorksheetsSheet. Game Shaun The Sheep 2. Activate. Set Chart Active.