Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2007

Tip: Looking for answers? Try searching our database.

Specify location of X Values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
johnhildreth@citynet.net - 17 Feb 2007 00:06 GMT
I am using the following code to build HLC Stock plots for
discontinuous ranges of data.  There are 4 ranges plotted and 4 ranges
that are the X value labels.  I am successful in referencing each
range and using them to designate the  chart source data.  But when I
use the Title ranges to set the XValues I get the address string (ie.
$F$6) and not the value in F6.  I tried replacing SizeTitle.Address
with SizeTitle.Value (and all remaining Title ranges).  This puts the
cell values as XValues, but in the reverse order.

I think the problem is that the XValues needs an array.  As the code
is now, sXVal looks like "$F$6,$K$6,$N$6,$R$6" which is an array.

   Dim sChartInput As String
   Dim s As Series
   Dim sXVal As String

   sChartInput = SizeRange.Address & "," & MOTRange.Address & _
       "," & TOYRange.Address & "," & TIQRange.Address

   sXVal = SizeTitle.Address & "," & MOTTitle.Address & _
       "," & TOYTitle.Address & "," & TIQTitle.Address

   Charts.Add

   ActiveChart.SetSourceData
Source:=Sheets("Drainage").Range(sChartInput), PlotBy:=xlRows

   For Each s In ActiveChart.SeriesCollection
       s.XValues = sXVal
   Next s

Thanks for any help,
John
Jon Peltier - 20 Feb 2007 03:36 GMT
I might try a range variable:

Dim rXVal as Range
rXVal = union(SizeTitle, MOTTitle, TOYTitle, TIQTitle)
s.XValues = rXVal

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

>I am using the following code to build HLC Stock plots for
> discontinuous ranges of data.  There are 4 ranges plotted and 4 ranges
[quoted text clipped - 29 lines]
> Thanks for any help,
> John
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.