Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
Lee Holsenbeck
 
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   Report Post  
Posted to microsoft.public.excel.charting
Jon Peltier
 
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



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
Value (Y) axis crosses between dates Frager Charts and Charting in Excel 2 January 18th 06 12:13 AM
line graph-need to pick up dates as values for the x axis? mountainair Charts and Charting in Excel 2 November 23rd 05 10:02 PM
Variable dates on X axis evenly spaced (should not be) Leo Bueno Charts and Charting in Excel 1 July 24th 05 04:16 PM
Formatting dates on x axis of chart...! saturnin02 Excel Discussion (Misc queries) 4 January 27th 05 09:55 PM
grouping dates by week/month/etc. on cat. axis Kamal Hood Charts and Charting in Excel 4 January 23rd 05 11:06 AM


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