Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Graph not plotting correctly if source not selected

Here my code:

Set Cht_level = Charts.Add
With Cht_level
.ChartType = xlLine
.SetSourceData Source:=cht_src
End With

if fails.

But if I

add cht_src.Select

before the code, it works brilliantly?

Why?
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 461
Default Graph not plotting correctly if source not selected

How is cht_src defined?

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/


On 6/6/2010 1:12 PM, Frank wrote:
Here my code:

Set Cht_level = Charts.Add
With Cht_level
.ChartType = xlLine
.SetSourceData Source:=cht_src
End With

if fails.

But if I

add cht_src.Select

before the code, it works brilliantly?

Why?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Graph not plotting correctly if source not selected

Hi Jon

I've actaully look at your site. It look you set the chart source as
selection.

Here is my non-working code"

Set cht_src = Range(Range("A1").Offset(1, 2 * (c + 1) + 2),
Range("A1").Offset(Application.Count(Range("dist_x _axys")) + 1, 2 * (c
+ 1) + 2 + c))

Set Cht_level = Charts.Add
With Cht_level
.ChartType = xlLine
.SetSourceData Source:=cht_src
End With


here is my working code:

Set cht_src = Range(Range("A1").Offset(1, 2 * (c + 1) + 2),
Range("A1").Offset(Application.Count(Range("dist_x _axys")) + 1, 2 * (c
+ 1) + 2 + c))

cht_src.Select

Set Cht_level = Charts.Add
With Cht_level
.ChartType = xlLine
.SetSourceData Source:=cht_src
End With

The only difference is the cht_src.Select

I find it odd that you need to select the chart source in order to
graph it correctly.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 461
Default Graph not plotting correctly if source not selected

Frank -

I find this strange too.

What if you remove the .Select statement, then move .ChartType after
..SetSourceData?

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/


On 6/7/2010 11:55 AM, Frank wrote:
Hi Jon

I've actaully look at your site. It look you set the chart source as
selection.

Here is my non-working code"

Set cht_src = Range(Range("A1").Offset(1, 2 * (c + 1) + 2),
Range("A1").Offset(Application.Count(Range("dist_x _axys")) + 1, 2 * (c
+ 1) + 2 + c))

Set Cht_level = Charts.Add
With Cht_level
.ChartType = xlLine
.SetSourceData Source:=cht_src
End With


here is my working code:

Set cht_src = Range(Range("A1").Offset(1, 2 * (c + 1) + 2),
Range("A1").Offset(Application.Count(Range("dist_x _axys")) + 1, 2 * (c
+ 1) + 2 + c))

cht_src.Select

Set Cht_level = Charts.Add
With Cht_level
.ChartType = xlLine
.SetSourceData Source:=cht_src
End With

The only difference is the cht_src.Select

I find it odd that you need to select the chart source in order to
graph it correctly.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Graph not plotting correctly if source not selected

Yep!

That works.

I'm learning every day.

Thanks
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
Why function generated results are not plotting correctly? Need Help on axis problem in a chart[_2_] Charts and Charting in Excel 1 March 8th 08 03:54 PM
Why function generated results are not plotting correctly? Need Help on axis problem in a chart Charts and Charting in Excel 1 March 6th 08 05:44 PM
Urgent help on plotting a X,Y graph... Jon Peltier Excel Programming 0 June 30th 07 08:31 PM
Plotting a Graph Mayank Excel Discussion (Misc queries) 2 June 9th 06 08:12 PM
Graph plotting Dovla Excel Programming 0 September 9th 04 02:05 PM


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