ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set Xvalues to an array of date, but the x-scale not correct (https://www.excelbanter.com/excel-programming/276288-re-set-xvalues-array-date-but-x-scale-not-correct.html)

Alan Pong[_2_]

Set Xvalues to an array of date, but the x-scale not correct
 
Tom, thanks for suggestion (using CLng).
yes, your sub-routine shows a curve with x-scale like this:
p1----p2----p3----p4


however, what i want the x-scale is, like this:
p1---p2-------p3---------------p4

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Tom Ogilvy

Set Xvalues to an array of date, but the x-scale not correct
 
To the best of my knowledge, that isn't supported. (although you claimed
you achieved what you want manually)

Perhaps you want to use a logarithmic scale.

--
Regards,
Tom Ogilvy


Alan Pong <no_spam_please wrote in message
...
Tom, thanks for suggestion (using CLng).
yes, your sub-routine shows a curve with x-scale like this:
p1----p2----p3----p4


however, what i want the x-scale is, like this:
p1---p2-------p3---------------p4

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!




Alan Pong[_2_]

Set Xvalues to an array of date, but the x-scale not correct
 
Tom, i get it by using Range:

A B
1 date price
2 2003/12/05 0.93
3 2008/09/03 3.26
4 2013/09/02 4.35
5 2033/08/28 5.21

Sub test()

Dim r As Range

Set r = Range("a2:a5")

'if the cells need change later.
'r.Item(1, 1) = CDate("2003/12/5")
'r.Item(2, 1) = CDate("2008/9/3")
'r.Item(3, 1) = CDate("2013/9/2")
'r.Item(4, 1) = CDate("2033/8/28")


ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1).XValues = r
ActiveSheet.ChartObjects(1).Chart.Axes(xlCategory, xlPrimary). _
TickLabels.NumberFormat = "mm/dd/yy"
b = Array(0.93, 3.26, 4.35, 5.21)
ActiveSheet.ChartObjects(1).Chart.SeriesCollection (1).Values = b

End Sub

--END

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 04:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com