Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 29
Default Macro to change X-axis scale has errors

I've read and studied code from a number of posts on this subject but my
"newbie" macro code has errors. I have the minimumscale value and
maximumscale value (entered by the user) stored in Sheet1 at $E$2 and $F$2.
My chart is in Sheet2. This is my complete macro:

Sub ChangeXAxisScale()
'
' ChangeXAxisScale Macro
'
With Worksheets("Sheet2")
With ActiveChart.Axes(1, 1)

.MinimumScale = Range("$E$2").Value
.MaximumScale = Range("$F$2").Value

End With
End With

End Sub

I know I am missing something(s) very basic and would appreciate your help.
Thanks.

I just bought the "Excel 2007 Macros Made Easy" book and am working my way
through it, although rather slowly.

Jim


  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 29
Default Macro to change X-axis scale has errors



"Cinco" wrote:

I've read and studied code from a number of posts on this subject but my
"newbie" macro code has errors. I have the minimumscale value and
maximumscale value (entered by the user) stored in Sheet1 at $E$2 and $F$2.
My chart is in Sheet2. This is my complete macro:

Sub ChangeXAxisScale()
'
' ChangeXAxisScale Macro
'
With Worksheets("Sheet2")
With ActiveChart.Axes(1, 1)

.MinimumScale = Range("$E$2").Value
.MaximumScale = Range("$F$2").Value

End With
End With

End Sub

I know I am missing something(s) very basic and would appreciate your help.
Thanks.

I just bought the "Excel 2007 Macros Made Easy" book and am working my way
through it, although rather slowly.

Jim


  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 29
Default Macro to change X-axis scale has errors



"Cinco" wrote:

I've read and studied code from a number of posts on this subject but my
"newbie" macro code has errors. I have the minimumscale value and
maximumscale value (entered by the user) stored in Sheet1 at $E$2 and $F$2.
My chart is in Sheet2. This is my complete macro:

Sub ChangeXAxisScale()
'
' ChangeXAxisScale Macro
'
With Worksheets("Sheet2")
With ActiveChart.Axes(1, 1)

.MinimumScale = Range("$E$2").Value
.MaximumScale = Range("$F$2").Value

End With
End With

End Sub

I know I am missing something(s) very basic and would appreciate your help.
Thanks.

I just bought the "Excel 2007 Macros Made Easy" book and am working my way
through it, although rather slowly.

Jim



The following macro works but only when run from the "chart" sheet. What do
I need to add so that it runs and uses the user entered input from Sheet1 and
not from the "chart" sheet? Thanks.

Sub ChangeXAxisScale()
'
' ChangeXAxisScale Macro
'
With ActiveSheet.ChartObjects(1).Chart.Axes(1, 1)

.MinimumScale = Range("$E$2")
.MaximumScale = Range("$F$2")

End With



End Sub
  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Macro to change X-axis scale has errors

Something like this:

.MinimumScale = Worksheets("Sheet1").Range("$E$2").Value
.MaximumScale = Worksheets("Sheet1").Range("$F$2").Value

And you have to make sure the minimum in E2 is not greater than the current
maximum.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Cinco" wrote in message
...


"Cinco" wrote:

I've read and studied code from a number of posts on this subject but my
"newbie" macro code has errors. I have the minimumscale value and
maximumscale value (entered by the user) stored in Sheet1 at $E$2 and
$F$2.
My chart is in Sheet2. This is my complete macro:

Sub ChangeXAxisScale()
'
' ChangeXAxisScale Macro
'
With Worksheets("Sheet2")
With ActiveChart.Axes(1, 1)

.MinimumScale = Range("$E$2").Value
.MaximumScale = Range("$F$2").Value

End With
End With

End Sub

I know I am missing something(s) very basic and would appreciate your
help.
Thanks.

I just bought the "Excel 2007 Macros Made Easy" book and am working my
way
through it, although rather slowly.

Jim



The following macro works but only when run from the "chart" sheet. What
do
I need to add so that it runs and uses the user entered input from Sheet1
and
not from the "chart" sheet? Thanks.

Sub ChangeXAxisScale()
'
' ChangeXAxisScale Macro
'
With ActiveSheet.ChartObjects(1).Chart.Axes(1, 1)

.MinimumScale = Range("$E$2")
.MaximumScale = Range("$F$2")

End With



End Sub

__________ Information from ESET Smart Security, version of virus
signature database 4221 (20090706) __________

The message was checked by ESET Smart Security.

http://www.eset.com






__________ Information from ESET Smart Security, version of virus signature database 4221 (20090706) __________

The message was checked by ESET Smart Security.

http://www.eset.com




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
Y axis scale macro hlmrspd Charts and Charting in Excel 5 June 27th 07 11:14 PM
How do I change the scale on the y axis to letters? Standard. Charts and Charting in Excel 3 June 19th 07 01:17 PM
how do i change the x-axis of a graph to a log scale? anne Charts and Charting in Excel 3 April 13th 06 07:30 PM
How do I change the scale of the catagory axis? amcmaster Charts and Charting in Excel 1 March 2nd 05 04:46 PM
Change the value axis scale SJ Charts and Charting in Excel 2 January 24th 05 07:17 PM


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