Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Rescale the Chat using VBA

Can any one help me out in rescaling the Chart using VBA (Visual Basic
Editor) in excel ?

Thanks and Regards,

Peri


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Rescale the Chat using VBA

Turn on the macro recorder and see what you get for methods and properties.
After editing the code to replace "ActiveChart" with a variable (for easier
debugging later), you should have something like the following. I also added
a quick error handler in case the currently active sheet is a worksheet
instead of a chart.

Sub RescaleChart()
Dim crtMyChart As Chart

On Error GoTo ErrRescaleChart

Set crtMyChart = ActiveWorkbook.Sheets("MyChart")

With crtMyChart.Axes(xlValue)
.MinimumScale = 10
.MaximumScale = 20
End With

With crtMyChart.Axes(xlCategory)
.MinimumScale = 1
.MaximumScale = 5
End With

Exit Sub

ErrRescaleChart:
MsgBox "Sheet is not a chart.", vbCritical + vbOKOnly
End Sub

Replace the constants with appropriate values, or functions that return a
value based on the data. You might also want to pass in an object variable
for the workbook and the chart as arguments, instead of developing them like
I did in the above example.
--
Regards,
Bill


"Peri" wrote in message
...
Can any one help me out in rescaling the Chart using VBA (Visual Basic
Editor) in excel ?

Thanks and Regards,

Peri



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Rescale the Chat using VBA

Turn on the macro recorder and see what you get for methods and properties.
After editing the code to replace "ActiveChart" with a variable (for easier
debugging later), you should have something like the following. I also added
a quick error handler in case the currently active sheet is a worksheet
instead of a chart.

Sub RescaleChart()
Dim crtMyChart As Chart

On Error GoTo ErrRescaleChart

Set crtMyChart = ActiveWorkbook.Sheets("MyChart")

With crtMyChart.Axes(xlValue)
.MinimumScale = 10
.MaximumScale = 20
End With

With crtMyChart.Axes(xlCategory)
.MinimumScale = 1
.MaximumScale = 5
End With

Exit Sub

ErrRescaleChart:
MsgBox "Sheet is not a chart.", vbCritical + vbOKOnly
End Sub

Replace the constants with appropriate values, or functions that return a
value based on the data. You might also want to pass in an object variable
for the workbook and the chart as arguments, instead of developing them like
I did in the above example.
--
Regards,
Bill


"Peri" wrote in message
...
Can any one help me out in rescaling the Chart using VBA (Visual Basic
Editor) in excel ?

Thanks and Regards,

Peri




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
Using the chat willie091028 Excel Discussion (Misc queries) 7 January 17th 07 10:43 PM
Chat sri Excel Discussion (Misc queries) 0 September 14th 06 01:02 PM
การดึง Excel ลงมาใช้ใน chat ทำโดยวิธีไหนไดเบ้างครับ ช่วยบอกผมทีนะค Excel to Chat... Charts and Charting in Excel 0 June 11th 05 12:51 PM
How to draw chat by entering equation Anne Charts and Charting in Excel 5 March 19th 05 02:43 AM
Chat Room Workle New Users to Excel 1 February 8th 05 02:42 PM


All times are GMT +1. The time now is 03:00 AM.

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

About Us

"It's about Microsoft Excel"