Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default VBA vs chart

Hi everybody, I have a problem I don't seem to be able to solve, maybe you
can help.
The following code add a chart:

Dim objChart As ChartObject
With ActiveSheet
Set objChart = .ChartObjects.Add(Left:=100, Width:=575, Top:=75, Height:=325)
objChart.Chart.SetSourceData Source:=Sheets("Data").Range("M11:O26")
objChart.Chart.ChartType = xlXYScatterLines
With objChart.Chart
..PlotArea.Interior.ColorIndex = xlNone
..Refresh
End With
End With

Column M11:M26 contain dates and time (in the following format 13.03.2006
14:15:00). After running this code the chart is created but it only show
00:00:00 on the x axis. Anyone know why or have any tip of how to solve this?

Thanks
Paal
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default VBA vs chart

Your code works fine in Excel 2002 and Excel 2003 on my PC, ensure the date
cells are correctly formatted and not contain invalid or missing values.

--
Cheers
Nigel



"Paal" wrote in message
...
Hi everybody, I have a problem I don't seem to be able to solve, maybe you
can help.
The following code add a chart:

Dim objChart As ChartObject
With ActiveSheet
Set objChart = .ChartObjects.Add(Left:=100, Width:=575, Top:=75,

Height:=325)
objChart.Chart.SetSourceData Source:=Sheets("Data").Range("M11:O26")
objChart.Chart.ChartType = xlXYScatterLines
With objChart.Chart
.PlotArea.Interior.ColorIndex = xlNone
.Refresh
End With
End With

Column M11:M26 contain dates and time (in the following format 13.03.2006
14:15:00). After running this code the chart is created but it only show
00:00:00 on the x axis. Anyone know why or have any tip of how to solve

this?

Thanks
Paal



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default VBA vs chart

I've tried it one more time after changing the number format of the column
and it was now ok. Thanks for the tip.

Paal

"Nigel" wrote:

Your code works fine in Excel 2002 and Excel 2003 on my PC, ensure the date
cells are correctly formatted and not contain invalid or missing values.

--
Cheers
Nigel



"Paal" wrote in message
...
Hi everybody, I have a problem I don't seem to be able to solve, maybe you
can help.
The following code add a chart:

Dim objChart As ChartObject
With ActiveSheet
Set objChart = .ChartObjects.Add(Left:=100, Width:=575, Top:=75,

Height:=325)
objChart.Chart.SetSourceData Source:=Sheets("Data").Range("M11:O26")
objChart.Chart.ChartType = xlXYScatterLines
With objChart.Chart
.PlotArea.Interior.ColorIndex = xlNone
.Refresh
End With
End With

Column M11:M26 contain dates and time (in the following format 13.03.2006
14:15:00). After running this code the chart is created but it only show
00:00:00 on the x axis. Anyone know why or have any tip of how to solve

this?

Thanks
Paal




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
Macro to change position of chart labels on line chart Shane Henderson[_2_] Charts and Charting in Excel 1 May 27th 11 09:31 AM
copy chart formatting and chart templates in Excel 2007 Astelix Charts and Charting in Excel 4 March 4th 10 04:10 AM
In Office 2007 can't see chart series values unless chart unprotec Carl Charts and Charting in Excel 0 October 28th 09 03:31 AM
Excel 2003 is missing Built-In Custom Chart Types in Chart Wizard Julius Charts and Charting in Excel 2 March 6th 09 04:43 PM
Excel 2003 is missing Built-In Custom Chart Types in Chart Wizard Julius Setting up and Configuration of Excel 1 March 6th 09 01:57 AM


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

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"