A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Please help w/ putting dates on x-axis with .XValues.



 
 
Thread Tools Display Modes
  #1  
Old January 25th, 2006, 05:53 PM posted to microsoft.public.excel.charting
external usenet poster
 
Posts: n/a
Default Please help w/ putting dates on x-axis with .XValues.

hi,

i'm trying to create charts and add series using VBA and reading from cells
from a different worksheet in the workbook. I have it all figured out, but
when i try and read the dates from the cells using this:
Sheet8.Range(Sheet8.Cells(2, 2), Sheet8.Cells(2, 18)) or this:
Sheet8.Range(Sheet8.Cells(FirstColumn, FirstRow), Sheet8.Cells(FirstColumn,
LastRow)), i get dates that are all over the place and look more like julian
dates, but when i use this: .XValues = Sheet8.Range("B2:B18"), it works fine.
Could someone please tell me what the issue is with this and a workaround if
you know of one.
My example is below.

Thanks,
Lee Holsenbeck

'Hard code the column value for the Y axis
YColumn = "6"
'Add a series
ChtObj.Chart.SeriesCollection.NewSeries
With ChtObj.Chart.SeriesCollection(1)
'Get the Y axis values from worksheet 8
.Values = Sheet8.Range(Sheet8.Cells(FirstRow, YColumn),
Sheet8.Cells(LastRow, YColumn))
'Sample Y axis values
'.Values = Sheet8.Range(Sheet8.Cells(2, 6), Sheet8.Cells(18,
6))
'Get the X axis values from worksheet 8
.XValues = Sheet8.Range(Sheet8.Cells(FirstColumn, FirstRow),
Sheet8.Cells(FirstColumn, LastRow))
'Sample x axis values
'.XValues = Sheet8.Range(Sheet8.Cells(2, 2), Sheet8.Cells(2,
18))
'.XValues = Sheet8.Range("B2:B18")
.Interior.ColorIndex = 3
.Border.ColorIndex = 3
.Name = "Gross Oil/Cond"
End With
  #2  
Old January 27th, 2006, 04:14 AM posted to microsoft.public.excel.charting
external usenet poster
 
Posts: n/a
Default Please help w/ putting dates on x-axis with .XValues.

This simple test in the Immediate Window worked for me:

activechart.seriescollection(1).xvalues =
activesheet.range(activesheet.cells(5,4),activeshe et.cells(11,4))

This is the same syntax that didn't work in your example.

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

"Lee Holsenbeck" wrote in message
...
hi,

i'm trying to create charts and add series using VBA and reading from
cells
from a different worksheet in the workbook. I have it all figured out, but
when i try and read the dates from the cells using this:
Sheet8.Range(Sheet8.Cells(2, 2), Sheet8.Cells(2, 18)) or this:
Sheet8.Range(Sheet8.Cells(FirstColumn, FirstRow),
Sheet8.Cells(FirstColumn,
LastRow)), i get dates that are all over the place and look more like
julian
dates, but when i use this: .XValues = Sheet8.Range("B2:B18"), it works
fine.
Could someone please tell me what the issue is with this and a wor

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
und if
you know of one.
My example is below.

Thanks,
Lee Holsenbeck

'Hard code the column value for the Y axis
YColumn = "6"
'Add a series
ChtObj.Chart.SeriesCollection.NewSeries
With ChtObj.Chart.SeriesCollection(1)
'Get the Y axis values from worksheet 8
.Values = Sheet8.Range(Sheet8.Cells(FirstRow, YColumn),
Sheet8.Cells(LastRow, YColumn))
'Sample Y axis values
'.Values = Sheet8.Range(Sheet8.Cells(2, 6),
Sheet8.Cells(18,
6))
'Get the X axis values from worksheet 8
.XValues = Sheet8.Range(Sheet8.Cells(FirstColumn,
FirstRow),
Sheet8.Cells(FirstColumn, LastRow))
'Sample x axis values
'.XValues = Sheet8.Range(Sheet8.Cells(2, 2),
Sheet8.Cells(2,
18))
'.XValues = Sheet8.Range("B2:B18")
.Interior.ColorIndex = 3
.Border.ColorIndex = 3
.Name = "Gross Oil/Cond"
End With



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Value (Y) axis crosses between dates Frager Charts and Charting 2 January 17th, 2006 11:13 PM
primary & secondary axis - format labels & positioning Maureen D. Powerpoint 5 November 3rd, 2005 03:22 AM
Newbie Questions - X Axis and Data Range Eli Charts and Charting 2 June 17th, 2005 01:54 AM
Problem with the display of a 2 axis chart Peter B Charts and Charting 1 August 4th, 2004 02:39 AM
Properly formatting Dates on the X axis Jon Peltier Charts and Charting 0 November 20th, 2003 06:27 PM


All times are GMT +1. The time now is 07:45 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.