#1   Report Post  
Posted to microsoft.public.excel.charting
Eric_B
 
Posts: n/a
Default Chart resize macro


I have a sheet that contains about 32 charts, since there are so many
charts I reduced the scale of the sheet so I can see all charts.
Problem is the charts are so small I can't interpret them. I want to
create a macro that re-sizes them when I click on them without having
to write a separate macro for each chart. Is there a way to return the
name of a chart to a variable? Here is what i have so far:

Dim ChtOb As ChartObject


With ActiveSheet

Set ChtOb = .ChartObjects("chart 1")


If ChtOb.Height < 1500 Then
With ChtOb
.Height = 1500
.Width = 2800
.Top = 34
.Left = 43
End With
Else
With ChtOb
.Height = 420
.Width = 715
.Top = 5
.Left = 5
End With
End If


--
Eric_B
------------------------------------------------------------------------
Eric_B's Profile: http://www.excelforum.com/member.php...o&userid=24486
View this thread: http://www.excelforum.com/showthread...hreadid=540641

  #2   Report Post  
Posted to microsoft.public.excel.charting
Jon Peltier
 
Posts: n/a
Default Chart resize macro

Right click on each chart, select Assign Macro, then select the name of this
macro.

Then put this in the macro:

Set ChtOb = .ChartObjects(Application.Caller)

When you run this macro, you might first determine app.caller's size, then
have the macro loop each chart in the sheet, and if it is larger than X
apply the smaller dimensions, then find the app.caller and if its original
size was small, increase its size.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

"Eric_B" wrote in
message ...

I have a sheet that contains about 32 charts, since there are so many
charts I reduced the scale of the sheet so I can see all charts.
Problem is the charts are so small I can't interpret them. I want to
create a macro that re-sizes them when I click on them without having
to write a separate macro for each chart. Is there a way to return the
name of a chart to a variable? Here is what i have so far:

Dim ChtOb As ChartObject


With ActiveSheet

Set ChtOb = .ChartObjects("chart 1")


If ChtOb.Height < 1500 Then
With ChtOb
Height = 1500
Width = 2800
Top = 34
Left = 43
End With
Else
With ChtOb
Height = 420
Width = 715
Top = 5
Left = 5
End With
End If


--
Eric_B
------------------------------------------------------------------------
Eric_B's Profile:
http://www.excelforum.com/member.php...o&userid=24486
View this thread: http://www.excelforum.com/showthread...hreadid=540641



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
Chart Property Confusion Arturo Charts and Charting in Excel 4 December 16th 05 05:13 AM
chart MAcro to change on activecell flow23 Excel Discussion (Misc queries) 0 December 7th 05 04:46 PM
Macro Help In Excel welshlad Excel Discussion (Misc queries) 14 October 26th 05 02:34 PM
Urgent Chart Assistance Brent E Charts and Charting in Excel 1 May 10th 05 09:09 AM
Urgent Chart Assistance Requested Brent E Excel Discussion (Misc queries) 0 May 9th 05 11:01 PM


All times are GMT +1. The time now is 06:24 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"