![]() |
deselect any "active" charts in workbook
I have a number of worksheets with scrolling charts charts on them (one chart
per worksheeet) that are updated programmatically. The chart update routine bombs when trying to modify a scrollbar property (.object.max) if a chart has been selected (i.e., someone clicked on a chart). I would like to add some code to my routine to deselect all active charts in the workbook prior to updating the scrollbar property. Can I deselect all active charts in a workbook? If so, how? All help will be greatly appreciated. Thanks in advance, Raul Thanks, Raul |
deselect any "active" charts in workbook
Loop through the worksheets, and select cell A1 on each.
For i = 1 To ActiveWorkbook.Worksheets.Count With ActiveWorkbook.Worksheets(i) .Activate .Range("A1").Select End With Next - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Raul" wrote in message ... I have a number of worksheets with scrolling charts charts on them (one chart per worksheeet) that are updated programmatically. The chart update routine bombs when trying to modify a scrollbar property (.object.max) if a chart has been selected (i.e., someone clicked on a chart). I would like to add some code to my routine to deselect all active charts in the workbook prior to updating the scrollbar property. Can I deselect all active charts in a workbook? If so, how? All help will be greatly appreciated. Thanks in advance, Raul Thanks, Raul |
deselect any "active" charts in workbook
Your solution worked like a charm.
I added an If statement to only activate worksheets with names that contain a desired string. For i = 1 To ActiveWorkbook.Worksheets.Count If InStr(1, ActiveWorkbook.Worksheets(i).Name, "Scrlng", 1) < 0 Then With ActiveWorkbook.Worksheets(i) .Activate .Range("A1").Select End With End If Next Thanks, Raul By the way, are there any advantages or disadvantages to using a for each loop? "Jon Peltier" wrote: Loop through the worksheets, and select cell A1 on each. For i = 1 To ActiveWorkbook.Worksheets.Count With ActiveWorkbook.Worksheets(i) .Activate .Range("A1").Select End With Next - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Raul" wrote in message ... I have a number of worksheets with scrolling charts charts on them (one chart per worksheeet) that are updated programmatically. The chart update routine bombs when trying to modify a scrollbar property (.object.max) if a chart has been selected (i.e., someone clicked on a chart). I would like to add some code to my routine to deselect all active charts in the workbook prior to updating the scrollbar property. Can I deselect all active charts in a workbook? If so, how? All help will be greatly appreciated. Thanks in advance, Raul Thanks, Raul |
All times are GMT +1. The time now is 09:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com