Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 113
Default Setting x-axis crosses with VBA

I have a chart that at the moment has a vertical range from -70 to
-92. I'm trying to set the horizontal axis to cross at the minimum
value, in this case -92. Using

With ActiveChart.Axes(xlValue)

.Crosses = xlMinimum

It crosses at -70.

If I use xlMaximum I get the same thing.

Using
.Crosses = xlCustom
.CrossesAt = -92

it crosses at -92. however, I need it to be dynamic so the x-axis
labels stay below the data field.

Am I using xlMinimum in a place it cannot be used?

Any help will be appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Setting x-axis crosses with VBA

In the format axis dialog, there is no way to specify that you want the axis
to cross at the minimum, only the maximum. I've long felt this to be an
oversight.

I assumed there was no way to specify maximum via VBA as well. After reading
of your dilemma, I looked it up in help, and sure enough, xlMinimum was
listed as one of the choices. Wow, I'd never noticed that, in over 10 years
of Excel VBA.

But when I tried it, it worked just like xlMaximum. You'll have to use the
custom option. By the way, it's not necessary to set .Crosses = xlCustom,
just use .CrossesAt = SomeValue, and the xlCustom thing happens for free.

What I usually do to ensure the axis will cross at the minimum no matter
what, is enter a ridiculously negative number, in your case, -9.99E300.

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


"Robert H" wrote in message
...
I have a chart that at the moment has a vertical range from -70 to
-92. I'm trying to set the horizontal axis to cross at the minimum
value, in this case -92. Using

With ActiveChart.Axes(xlValue)

.Crosses = xlMinimum

It crosses at -70.

If I use xlMaximum I get the same thing.

Using
.Crosses = xlCustom
.CrossesAt = -92

it crosses at -92. however, I need it to be dynamic so the x-axis
labels stay below the data field.

Am I using xlMinimum in a place it cannot be used?

Any help will be appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 113
Default Setting x-axis crosses with VBA

I thought something was odd about xlMinimum being available in the
object but not not an option in the chart scale options. Thanks for
the workaround that is essentially the same thing. the code generates
several charts based on different data types. Ill probably use IF THEN
to set the "ridiculous" minimum appropriately.
Thanks Again
Robert

On Dec 14, 12:52*am, "Jon Peltier"
wrote:
In the format axis dialog, there is no way to specify that you want the axis
to cross at the minimum, only the maximum. I've long felt this to be an
oversight.

I assumed there was no way to specify maximum via VBA as well. After reading
of your dilemma, I looked it up in help, and sure enough, xlMinimum was
listed as one of the choices. Wow, I'd never noticed that, in over 10 years
of Excel VBA.

But when I tried it, it worked just like xlMaximum. You'll have to use the
custom option. By the way, it's not necessary to set .Crosses = xlCustom,
just use .CrossesAt = SomeValue, and the xlCustom thing happens for free.

What I usually do to ensure the axis will cross at the minimum no matter
what, is enter a ridiculously negative number, in your case, -9.99E300.

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

"Robert H" wrote in message

...

I have a chart that at the moment has a vertical range from -70 to
-92. I'm trying to set the horizontal axis to cross at the minimum
value, in this case -92. Using


With ActiveChart.Axes(xlValue)


* * .Crosses = xlMinimum


It crosses at -70.


If I use xlMaximum I get the same thing.


Using
* * * * * *.Crosses = xlCustom
* * * * * *.CrossesAt = -92


it crosses at -92. however, I need it to be dynamic so the x-axis
labels stay below the data field.


Am I using xlMinimum in a place it cannot be used?


Any help will be appreciated.


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
How do I change where category x axis crosses the 2nd y axis? epu Charts and Charting in Excel 7 October 28th 08 02:31 PM
Using a cell reference as the axis value for Horizontal axis crosses [email protected] Charts and Charting in Excel 4 January 25th 08 01:59 PM
Value (Y) axis crosses between categories and Secondary Value (Y) Axis -markc Charts and Charting in Excel 2 October 31st 07 07:03 PM
Value (Y) axis crosses between dates Frager Charts and Charting in Excel 2 January 17th 06 11:13 PM
Format Axis; Scale Tab; "Value Axis Crosses At" ends with preposit Pedant Charts and Charting in Excel 1 August 29th 05 03:50 AM


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