LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Changing a horizontal axis crosses value using VBA

I have just started trying to learn VBA since the 1st of the year. I
used macro recorder to record changes in the "Format Axis" "Axis
Options" "Horizontal Axis Crosses" "Axis value" or the "CrossesAt"
portion of a chart. Because I wanted to be able to enter a crosses at
value into a cell I added the = Range(). The following code is working
except there is a short wait while the code is executing.

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Axes(xlValue).CrossesAt = Range("I21")
ActiveSheet.ChartObjects("Chart 2").Activate
ActiveChart.Axes(xlValue).CrossesAt = Range("J21")
ActiveSheet.ChartObjects("Chart 3").Activate
ActiveChart.Axes(xlValue).CrossesAt = Range("K21")
ActiveSheet.ChartObjects("Chart 4").Activate
ActiveChart.Axes(xlValue).CrossesAt = Range("L21")
ActiveSheet.ChartObjects("Chart 5").Activate
ActiveChart.Axes(xlValue).CrossesAt = Range("M21")
ActiveSheet.ChartObjects("Chart 6").Activate
ActiveChart.Axes(xlValue).CrossesAt = Range("N21")
ActiveSheet.ChartObjects("Chart 7").Activate
ActiveChart.Axes(xlValue).CrossesAt = Range("O21")
ActiveSheet.ChartObjects("Chart 8").Activate
ActiveChart.Axes(xlValue).CrossesAt = Range("P21")
ActiveSheet.ChartObjects("Chart 9").Activate
ActiveChart.Axes(xlValue).CrossesAt = Range("Q21")

Here is what I'm trying to do now. If the value in the chart is the
same as in the cell I want to skip the code for that chart. So if the
value in the cell is different need to run. I can't figure out how to
compare the 2 values. This is what I have attempted without sucess.

ActiveSheet.ChartObjects("Chart 1").Activate
If Not ActiveChart.Axes(xlValue).CrossesAt.Value =
Range("I20") Then
ActiveChart.Axes(xlValue).CrossesAt.Value = Range("I20")
End If

I sure it something very simple and basic but I'm not sure what to do.
Thanks in advance
 
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
Changing the Horizontal Axis Range in an X-Y Scatter Remmy Excel Discussion (Misc queries) 0 September 24th 09 02:36 PM
Changing scale on horizontal axis... curvature Excel Discussion (Misc queries) 1 December 20th 08 03:20 PM
Horizontal Axis Options Changing JakBob Charts and Charting in Excel 6 August 30th 08 12:28 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
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 08:07 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"