#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6,582
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6,582
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re-size Bars in Bar Graph SLKoelker Charts and Charting in Excel 2 October 3rd 07 04:22 PM
graph size grantr Charts and Charting in Excel 0 August 18th 06 03:31 PM
Can I make a graph to be a specific size? (actual graph) Jessica Excel Discussion (Misc queries) 0 August 14th 06 08:45 PM
2graph with the same Xvalue and same Size of graph c06 Charts and Charting in Excel 1 April 10th 06 03:47 PM
How to increase the size of a Pivot Table Graph cdavidson Excel Discussion (Misc queries) 1 March 16th 05 03:20 PM


All times are GMT +1. The time now is 03:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"