If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Furtive Bug!
On different worksheets are (Forms) Buttons with the below
macros assigned to them. "GoToUtilizationChart()" works perfectly, but "GoToPPVChart()" only brings up the "Metrics" worksheet and cursors to A1 - it does not select the chart. Chart names are confirmed correct. To test the problem, I copy/pasted the "Utilization" macro and substituted "PPV" and "3" in the code - still doesn't select the PPV chart. Can someone help me exterminate this bug?! Appreciate any help... Phil Sub GoToPPVChart() Sheets("Metrics").Select Range("A1").Select With ActiveSheet.ChartObjects("Chart 13") .Height = 660 .Width = 780 .Top = 10 .Left = 125 End With End Sub Sub GoToUtilizationChart() Sheets("Metrics").Select Range("A1").Select With ActiveSheet.ChartObjects("Chart 17") .Height = 660 .Width = 780 .Top = 10 .Left = 125 End With End Sub |
#3
|
|||
|
|||
Furtive Bug!
Tushar, Thanks for your replay.
Maybe "select" is the wrong term. When the button is clicked, the "Metrics" worksheet should comes on screen, the cursor should go to A1, and the chart called for in the macro should become current, sized, and move to the Top/Left position. In this problem, the "Utilization" chart is performing exactly this way; but the "PPV" chart doesn't resize or position. Is there another way to get the desired result? No error handling is enabled. -----Original Message----- Nothing in the code attempts to select any chart. So, I'm at a loss as to why you expect a chart to be selected. Is the chart the correct size and at the correct location after the macro finishes? Do you have any error handling enabled? If so, disable it. -- Regards, Tushar Mehta, MS MVP -- Excel www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article , says... On different worksheets are (Forms) Buttons with the below macros assigned to them. "GoToUtilizationChart()" works perfectly, but "GoToPPVChart()" only brings up the "Metrics" worksheet and cursors to A1 - it does not select the chart. Chart names are confirmed correct. To test the problem, I copy/pasted the "Utilization" macro and substituted "PPV" and "3" in the code - still doesn't select the PPV chart. Can someone help me exterminate this bug?! Appreciate any help... Phil Sub GoToPPVChart() Sheets("Metrics").Select Range("A1").Select With ActiveSheet.ChartObjects("Chart 13") .Height = 660 .Width = 780 .Top = 10 .Left = 125 End With End Sub Sub GoToUtilizationChart() Sheets("Metrics").Select Range("A1").Select With ActiveSheet.ChartObjects("Chart 17") .Height = 660 .Width = 780 .Top = 10 .Left = 125 End With End Sub . |
#4
|
|||
|
|||
Furtive Bug!
Phil -
I just tried your procedures with two charts (13 & 17), without changing a bit of the code. Both worked fine, as I expected, with the sheet unprotected and protected. How did you verify the chart names? Run this short program: Sub ListCharts() Dim msg As String Dim chtob As ChartObject msg = ActiveSheet.Name & vbCrLf For Each chtob In ActiveSheet.ChartObjects msg = msg & vbCrLf & chtob.Name Next MsgBox msg End Sub It should give you this (and more if there are more charts): Metrics Chart 13 Chart 17 What do you get? - Jon ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Phil Hageman wrote: Tushar, Thanks for your replay. Maybe "select" is the wrong term. When the button is clicked, the "Metrics" worksheet should comes on screen, the cursor should go to A1, and the chart called for in the macro should become current, sized, and move to the Top/Left position. In this problem, the "Utilization" chart is performing exactly this way; but the "PPV" chart doesn't resize or position. Is there another way to get the desired result? No error handling is enabled. -----Original Message----- Nothing in the code attempts to select any chart. So, I'm at a loss as to why you expect a chart to be selected. Is the chart the correct size and at the correct location after the macro finishes? Do you have any error handling enabled? If so, disable it. -- Regards, Tushar Mehta, MS MVP -- Excel www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article , says... On different worksheets are (Forms) Buttons with the below macros assigned to them. "GoToUtilizationChart()" works perfectly, but "GoToPPVChart()" only brings up the "Metrics" worksheet and cursors to A1 - it does not select the chart. Chart names are confirmed correct. To test the problem, I copy/pasted the "Utilization" macro and substituted "PPV" and "3" in the code - still doesn't select the PPV chart. Can someone help me exterminate this bug?! Appreciate any help... Phil Sub GoToPPVChart() Sheets("Metrics").Select Range("A1").Select With ActiveSheet.ChartObjects("Chart 13") .Height = 660 .Width = 780 .Top = 10 .Left = 125 End With End Sub Sub GoToUtilizationChart() Sheets("Metrics").Select Range("A1").Select With ActiveSheet.ChartObjects("Chart 17") .Height = 660 .Width = 780 .Top = 10 .Left = 125 End With End Sub . |
#5
|
|||
|
|||
Msg Box Works
Jon, the message box came up with:
Chart 13 Chart 17 Chart 33 Chart 36 Tell you what, let me play with this some more and get back to you. I have two versions of this code which work (both on my threads in this NG). This problem seems intermittant and must be coming from another area of the workbook. I will post tomorrow if I run into trouble... Thanks for all your help. Phil -----Original Message----- Phil - I just tried your procedures with two charts (13 & 17), without changing a bit of the code. Both worked fine, as I expected, with the sheet unprotected and protected. How did you verify the chart names? Run this short program: Sub ListCharts() Dim msg As String Dim chtob As ChartObject msg = ActiveSheet.Name & vbCrLf For Each chtob In ActiveSheet.ChartObjects msg = msg & vbCrLf & chtob.Name Next MsgBox msg End Sub It should give you this (and more if there are more charts): Metrics Chart 13 Chart 17 What do you get? - Jon ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Phil Hageman wrote: Tushar, Thanks for your replay. Maybe "select" is the wrong term. When the button is clicked, the "Metrics" worksheet should comes on screen, the cursor should go to A1, and the chart called for in the macro should become current, sized, and move to the Top/Left position. In this problem, the "Utilization" chart is performing exactly this way; but the "PPV" chart doesn't resize or position. Is there another way to get the desired result? No error handling is enabled. -----Original Message----- Nothing in the code attempts to select any chart. So, I'm at a loss as to why you expect a chart to be selected. Is the chart the correct size and at the correct location after the macro finishes? Do you have any error handling enabled? If so, disable it. -- Regards, Tushar Mehta, MS MVP -- Excel www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article , says... On different worksheets are (Forms) Buttons with the below macros assigned to them. "GoToUtilizationChart()" works perfectly, but "GoToPPVChart()" only brings up the "Metrics" worksheet and cursors to A1 - it does not select the chart. Chart names are confirmed correct. To test the problem, I copy/pasted the "Utilization" macro and substituted "PPV" and "3" in the code - still doesn't select the PPV chart. Can someone help me exterminate this bug?! Appreciate any help... Phil Sub GoToPPVChart() Sheets("Metrics").Select Range("A1").Select With ActiveSheet.ChartObjects("Chart 13") .Height = 660 .Width = 780 .Top = 10 .Left = 125 End With End Sub Sub GoToUtilizationChart() Sheets("Metrics").Select Range("A1").Select With ActiveSheet.ChartObjects("Chart 17") .Height = 660 .Width = 780 .Top = 10 .Left = 125 End With End Sub . . |
#6
|
|||
|
|||
Msg Box Works
Phil -
Okay, now we're down to basics. Restart Excel, and see if it works. Copy the charts to another sheet, and see if it works. Rebuild the charts in a new workbook, and see if it works. Trade in your balky old monster for a sleek new laptop, and see if it works. That last step might be a bit extreme, but I am beginning to suspect that your workbook is becoming corrupt. Another thing: it's possible to put additional layers of protection on a chart. Some of these would interfere with the code. But you need VBA to do it, so you'd probably remember that you'd done such a thing. - Jon ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Phil Hageman wrote: Jon, the message box came up with: Chart 13 Chart 17 Chart 33 Chart 36 Tell you what, let me play with this some more and get back to you. I have two versions of this code which work (both on my threads in this NG). This problem seems intermittant and must be coming from another area of the workbook. I will post tomorrow if I run into trouble... Thanks for all your help. Phil -----Original Message----- Phil - I just tried your procedures with two charts (13 & 17), without changing a bit of the code. Both worked fine, as I expected, with the sheet unprotected and protected. How did you verify the chart names? Run this short program: Sub ListCharts() Dim msg As String Dim chtob As ChartObject msg = ActiveSheet.Name & vbCrLf For Each chtob In ActiveSheet.ChartObjects msg = msg & vbCrLf & chtob.Name Next MsgBox msg End Sub It should give you this (and more if there are more charts): Metrics Chart 13 Chart 17 What do you get? - Jon ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Phil Hageman wrote: Tushar, Thanks for your replay. Maybe "select" is the wrong term. When the button is clicked, the "Metrics" worksheet should comes on screen, the cursor should go to A1, and the chart called for in the macro should become current, sized, and move to the Top/Left position. In this problem, the "Utilization" chart is performing exactly this way; but the "PPV" chart doesn't resize or position. Is there another way to get the desired result? No error handling is enabled. -----Original Message----- Nothing in the code attempts to select any chart. So, I'm at a loss as to why you expect a chart to be selected. Is the chart the correct size and at the correct location after the macro finishes? Do you have any error handling enabled? If so, disable it. -- Regards, Tushar Mehta, MS MVP -- Excel www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article , says... On different worksheets are (Forms) Buttons with the below macros assigned to them. "GoToUtilizationChart()" works perfectly, but "GoToPPVChart()" only brings up the "Metrics" worksheet and cursors to A1 - it does not select the chart. Chart names are confirmed correct. To test the problem, I copy/pasted the "Utilization" macro and substituted "PPV" and "3" in the code - still doesn't select the PPV chart. Can someone help me exterminate this bug?! Appreciate any help... Phil Sub GoToPPVChart() Sheets("Metrics").Select Range("A1").Select With ActiveSheet.ChartObjects("Chart 13") .Height = 660 .Width = 780 .Top = 10 .Left = 125 End With End Sub Sub GoToUtilizationChart() Sheets("Metrics").Select Range("A1").Select With ActiveSheet.ChartObjects("Chart 17") .Height = 660 .Width = 780 .Top = 10 .Left = 125 End With End Sub . . |
Thread Tools | |
Display Modes | |
|
|