Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Graph Re-size Macro
I want to be able to create a button that will automatically enlarge a graph,
and then when it is pushed again will shrink the graph back to its original size. I tried doing this and the graph kept shifting to the left every time I pressed the button. I do not want the graph to move, only to resize. Thanks Adam Bush |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Graph Re-size Macro
If you want suggestions on your existing code, you should post it.
How about changing the window zoom instead of messing with the chart? - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ " m wrote in message ... I want to be able to create a button that will automatically enlarge a graph, and then when it is pushed again will shrink the graph back to its original size. I tried doing this and the graph kept shifting to the left every time I pressed the button. I do not want the graph to move, only to resize. Thanks Adam Bush |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Graph Re-size Macro
Jon,
Thanks for the reply. Here is the code for enlarging the graphs: ActiveSheet.ChartObjects("Chart 357").Activate ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 357").ScaleWidth 1.36, msoFalse, _ msoScaleFromBottomRight ActiveSheet.Shapes("Chart 357").ScaleHeight 2.4, msoFalse, _ msoScaleFromBottomRight ActiveWindow.Visible = False Windows("Everything Regression Prototype.xls").Activate ActiveSheet.ChartObjects("Chart 358").Activate ActiveChart.Axes(xlValue).Select ActiveChart.Legend.Select ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 358").ScaleWidth 1.18, msoFalse, msoScaleFromTopLeft ActiveSheet.Shapes("Chart 358").ScaleHeight 2.4, msoFalse, _ msoScaleFromBottomRight And here is the code for shrinking the graphs: ActiveSheet.ChartObjects("Chart 357").Activate ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 357").ScaleWidth 0.58, msoFalse, _ msoScaleFromBottomRight ActiveSheet.Shapes("Chart 357").ScaleHeight 0.36, msoFalse, _ msoScaleFromBottomRight ActiveWindow.Visible = False Windows("Everything Regression Prototype.xls").Activate ActiveSheet.ChartObjects("Chart 358").Activate ActiveChart.ChartTitle.Select ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 358").ScaleWidth 0.73, msoFalse, _ msoScaleFromBottomRight ActiveSheet.Shapes("Chart 358").ScaleHeight 0.44, msoFalse, _ msoScaleFromBottomRight All I did was record a macro and then drag the corner of the graohs to resize them. I have a feeling the problem has to do with Scaling from the bottom right in the code. How would I change the window zoom? The key here is I need to be able to do this through the push of a button. Thanks Adam Bush "Jon Peltier" wrote: If you want suggestions on your existing code, you should post it. How about changing the window zoom instead of messing with the chart? - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ " m wrote in message ... I want to be able to create a button that will automatically enlarge a graph, and then when it is pushed again will shrink the graph back to its original size. I tried doing this and the graph kept shifting to the left every time I pressed the button. I do not want the graph to move, only to resize. Thanks Adam Bush |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Graph Re-size Macro
Push of a button is no big deal.
I find it better to change the dimensions of a chart explicitly, rather than scaling its dimensions. Select the chart and run either of these procedures: Const dScale as Double = 2.4 Sub ChartExpand() With ActiveChart.Parent .Height = .Height * dScale .Width = .Width * dScale End With End Sub Sub ChartShrink() With ActiveChart.Parent .Height = .Height / dScale .Width = .Width / dScale End With End Sub To change the window zoom: Sub WindowZoomIn() ActiveWindow.Zoom = ActiveWindow.Zoom * 2 End Sub Sub WindowZoomOut() ActiveWindow.Zoom = ActiveWindow.Zoom / 2 End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ " m wrote in message ... Jon, Thanks for the reply. Here is the code for enlarging the graphs: ActiveSheet.ChartObjects("Chart 357").Activate ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 357").ScaleWidth 1.36, msoFalse, _ msoScaleFromBottomRight ActiveSheet.Shapes("Chart 357").ScaleHeight 2.4, msoFalse, _ msoScaleFromBottomRight ActiveWindow.Visible = False Windows("Everything Regression Prototype.xls").Activate ActiveSheet.ChartObjects("Chart 358").Activate ActiveChart.Axes(xlValue).Select ActiveChart.Legend.Select ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 358").ScaleWidth 1.18, msoFalse, msoScaleFromTopLeft ActiveSheet.Shapes("Chart 358").ScaleHeight 2.4, msoFalse, _ msoScaleFromBottomRight And here is the code for shrinking the graphs: ActiveSheet.ChartObjects("Chart 357").Activate ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 357").ScaleWidth 0.58, msoFalse, _ msoScaleFromBottomRight ActiveSheet.Shapes("Chart 357").ScaleHeight 0.36, msoFalse, _ msoScaleFromBottomRight ActiveWindow.Visible = False Windows("Everything Regression Prototype.xls").Activate ActiveSheet.ChartObjects("Chart 358").Activate ActiveChart.ChartTitle.Select ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 358").ScaleWidth 0.73, msoFalse, _ msoScaleFromBottomRight ActiveSheet.Shapes("Chart 358").ScaleHeight 0.44, msoFalse, _ msoScaleFromBottomRight All I did was record a macro and then drag the corner of the graohs to resize them. I have a feeling the problem has to do with Scaling from the bottom right in the code. How would I change the window zoom? The key here is I need to be able to do this through the push of a button. Thanks Adam Bush "Jon Peltier" wrote: If you want suggestions on your existing code, you should post it. How about changing the window zoom instead of messing with the chart? - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ " m wrote in message ... I want to be able to create a button that will automatically enlarge a graph, and then when it is pushed again will shrink the graph back to its original size. I tried doing this and the graph kept shifting to the left every time I pressed the button. I do not want the graph to move, only to resize. Thanks Adam Bush |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Graph Re-size Macro
Jon,
Thanks a lot for your help. Adam Bush "Jon Peltier" wrote: Push of a button is no big deal. I find it better to change the dimensions of a chart explicitly, rather than scaling its dimensions. Select the chart and run either of these procedures: Const dScale as Double = 2.4 Sub ChartExpand() With ActiveChart.Parent .Height = .Height * dScale .Width = .Width * dScale End With End Sub Sub ChartShrink() With ActiveChart.Parent .Height = .Height / dScale .Width = .Width / dScale End With End Sub To change the window zoom: Sub WindowZoomIn() ActiveWindow.Zoom = ActiveWindow.Zoom * 2 End Sub Sub WindowZoomOut() ActiveWindow.Zoom = ActiveWindow.Zoom / 2 End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ " m wrote in message ... Jon, Thanks for the reply. Here is the code for enlarging the graphs: ActiveSheet.ChartObjects("Chart 357").Activate ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 357").ScaleWidth 1.36, msoFalse, _ msoScaleFromBottomRight ActiveSheet.Shapes("Chart 357").ScaleHeight 2.4, msoFalse, _ msoScaleFromBottomRight ActiveWindow.Visible = False Windows("Everything Regression Prototype.xls").Activate ActiveSheet.ChartObjects("Chart 358").Activate ActiveChart.Axes(xlValue).Select ActiveChart.Legend.Select ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 358").ScaleWidth 1.18, msoFalse, msoScaleFromTopLeft ActiveSheet.Shapes("Chart 358").ScaleHeight 2.4, msoFalse, _ msoScaleFromBottomRight And here is the code for shrinking the graphs: ActiveSheet.ChartObjects("Chart 357").Activate ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 357").ScaleWidth 0.58, msoFalse, _ msoScaleFromBottomRight ActiveSheet.Shapes("Chart 357").ScaleHeight 0.36, msoFalse, _ msoScaleFromBottomRight ActiveWindow.Visible = False Windows("Everything Regression Prototype.xls").Activate ActiveSheet.ChartObjects("Chart 358").Activate ActiveChart.ChartTitle.Select ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 358").ScaleWidth 0.73, msoFalse, _ msoScaleFromBottomRight ActiveSheet.Shapes("Chart 358").ScaleHeight 0.44, msoFalse, _ msoScaleFromBottomRight All I did was record a macro and then drag the corner of the graohs to resize them. I have a feeling the problem has to do with Scaling from the bottom right in the code. How would I change the window zoom? The key here is I need to be able to do this through the push of a button. Thanks Adam Bush "Jon Peltier" wrote: If you want suggestions on your existing code, you should post it. How about changing the window zoom instead of messing with the chart? - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ " m wrote in message ... I want to be able to create a button that will automatically enlarge a graph, and then when it is pushed again will shrink the graph back to its original size. I tried doing this and the graph kept shifting to the left every time I pressed the button. I do not want the graph to move, only to resize. Thanks Adam Bush |
#6
Posted to microsoft.public.excel.misc
|
|||
|
|||
Graph Re-size Macro
Jon,
Thank you very much. Your idea worked perfectly. Adam Bush " wrote: Jon, Thanks a lot for your help. Adam Bush "Jon Peltier" wrote: Push of a button is no big deal. I find it better to change the dimensions of a chart explicitly, rather than scaling its dimensions. Select the chart and run either of these procedures: Const dScale as Double = 2.4 Sub ChartExpand() With ActiveChart.Parent .Height = .Height * dScale .Width = .Width * dScale End With End Sub Sub ChartShrink() With ActiveChart.Parent .Height = .Height / dScale .Width = .Width / dScale End With End Sub To change the window zoom: Sub WindowZoomIn() ActiveWindow.Zoom = ActiveWindow.Zoom * 2 End Sub Sub WindowZoomOut() ActiveWindow.Zoom = ActiveWindow.Zoom / 2 End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ " m wrote in message ... Jon, Thanks for the reply. Here is the code for enlarging the graphs: ActiveSheet.ChartObjects("Chart 357").Activate ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 357").ScaleWidth 1.36, msoFalse, _ msoScaleFromBottomRight ActiveSheet.Shapes("Chart 357").ScaleHeight 2.4, msoFalse, _ msoScaleFromBottomRight ActiveWindow.Visible = False Windows("Everything Regression Prototype.xls").Activate ActiveSheet.ChartObjects("Chart 358").Activate ActiveChart.Axes(xlValue).Select ActiveChart.Legend.Select ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 358").ScaleWidth 1.18, msoFalse, msoScaleFromTopLeft ActiveSheet.Shapes("Chart 358").ScaleHeight 2.4, msoFalse, _ msoScaleFromBottomRight And here is the code for shrinking the graphs: ActiveSheet.ChartObjects("Chart 357").Activate ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 357").ScaleWidth 0.58, msoFalse, _ msoScaleFromBottomRight ActiveSheet.Shapes("Chart 357").ScaleHeight 0.36, msoFalse, _ msoScaleFromBottomRight ActiveWindow.Visible = False Windows("Everything Regression Prototype.xls").Activate ActiveSheet.ChartObjects("Chart 358").Activate ActiveChart.ChartTitle.Select ActiveChart.ChartArea.Select ActiveSheet.Shapes("Chart 358").ScaleWidth 0.73, msoFalse, _ msoScaleFromBottomRight ActiveSheet.Shapes("Chart 358").ScaleHeight 0.44, msoFalse, _ msoScaleFromBottomRight All I did was record a macro and then drag the corner of the graohs to resize them. I have a feeling the problem has to do with Scaling from the bottom right in the code. How would I change the window zoom? The key here is I need to be able to do this through the push of a button. Thanks Adam Bush "Jon Peltier" wrote: If you want suggestions on your existing code, you should post it. How about changing the window zoom instead of messing with the chart? - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ " m wrote in message ... I want to be able to create a button that will automatically enlarge a graph, and then when it is pushed again will shrink the graph back to its original size. I tried doing this and the graph kept shifting to the left every time I pressed the button. I do not want the graph to move, only to resize. Thanks Adam Bush |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Re-size Bars in Bar Graph | Charts and Charting in Excel | |||
graph size | Charts and Charting in Excel | |||
Can I make a graph to be a specific size? (actual graph) | Excel Discussion (Misc queries) | |||
2graph with the same Xvalue and same Size of graph | Charts and Charting in Excel | |||
How to increase the size of a Pivot Table Graph | Excel Discussion (Misc queries) |