Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Macro producing chart from variable length column

I'm trying to produce a chart in excel from variable length column using a
macro. I find the bottom of the column and assign the row number to variable
K. I then want to assign the SeriesCollection XValues and Values but can't
seem to do it using the Cells notation as shown below. Is there another way
to approach this using the variable K for the last row in the range?

ActiveChart.SeriesCollection(1).XValues =
ActiveSheet.Range(ActiveSheet.Cells(2, 1), ActiveSheet.Cells(K, 1))

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Macro producing chart from variable length column

Assuming that it's all on one line in your code, it looks OK to me. What error
are you getting?

On Wed, 27 Oct 2004 19:15:03 -0700, "johnk"
wrote:

I'm trying to produce a chart in excel from variable length column using a
macro. I find the bottom of the column and assign the row number to variable
K. I then want to assign the SeriesCollection XValues and Values but can't
seem to do it using the Cells notation as shown below. Is there another way
to approach this using the variable K for the last row in the range?

ActiveChart.SeriesCollection(1).XValues =
ActiveSheet.Range(ActiveSheet.Cells(2, 1), ActiveSheet.Cells(K, 1))

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Macro producing chart from variable length column

I get Run-time error 438, Object doesn't support this property or method.

"Myrna Larson" wrote:

Assuming that it's all on one line in your code, it looks OK to me. What error
are you getting?

On Wed, 27 Oct 2004 19:15:03 -0700, "johnk"
wrote:

I'm trying to produce a chart in excel from variable length column using a
macro. I find the bottom of the column and assign the row number to variable
K. I then want to assign the SeriesCollection XValues and Values but can't
seem to do it using the Cells notation as shown below. Is there another way
to approach this using the variable K for the last row in the range?

ActiveChart.SeriesCollection(1).XValues =
ActiveSheet.Range(ActiveSheet.Cells(2, 1), ActiveSheet.Cells(K, 1))

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Macro producing chart from variable length column

Is the chart embedded or on a separate sheet? If the latter, which is the
active sheet when the code runs? Is there an active chart?

Will it work correctly if you refer to the worksheet by name -- e.g.
Worksheets("Sheet1")

and refer to the chart by name?


On Wed, 27 Oct 2004 19:49:05 -0700, johnrkeir
wrote:

I get Run-time error 438, Object doesn't support this property or method.

"Myrna Larson" wrote:

Assuming that it's all on one line in your code, it looks OK to me. What

error
are you getting?

On Wed, 27 Oct 2004 19:15:03 -0700, "johnk"


wrote:

I'm trying to produce a chart in excel from variable length column using a
macro. I find the bottom of the column and assign the row number to

variable
K. I then want to assign the SeriesCollection XValues and Values but

can't
seem to do it using the Cells notation as shown below. Is there another

way
to approach this using the variable K for the last row in the range?

ActiveChart.SeriesCollection(1).XValues =
ActiveSheet.Range(ActiveSheet.Cells(2, 1), ActiveSheet.Cells(K, 1))

Thanks




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Macro producing chart from variable length column

Thanks, I used Sheets("Sheet1") ... and it worked.

"Myrna Larson" wrote:

Is the chart embedded or on a separate sheet? If the latter, which is the
active sheet when the code runs? Is there an active chart?

Will it work correctly if you refer to the worksheet by name -- e.g.
Worksheets("Sheet1")

and refer to the chart by name?


On Wed, 27 Oct 2004 19:49:05 -0700, johnrkeir
wrote:

I get Run-time error 438, Object doesn't support this property or method.

"Myrna Larson" wrote:

Assuming that it's all on one line in your code, it looks OK to me. What

error
are you getting?

On Wed, 27 Oct 2004 19:15:03 -0700, "johnk"


wrote:

I'm trying to produce a chart in excel from variable length column using a
macro. I find the bottom of the column and assign the row number to

variable
K. I then want to assign the SeriesCollection XValues and Values but

can't
seem to do it using the Cells notation as shown below. Is there another

way
to approach this using the variable K for the last row in the range?

ActiveChart.SeriesCollection(1).XValues =
ActiveSheet.Range(ActiveSheet.Cells(2, 1), ActiveSheet.Cells(K, 1))

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
Using a Macro to Sum a Variable-Length Range (a Column) Chuckles123[_15_] Excel Programming 0 October 5th 04 06:46 AM
Using a Macro to Sum a Variable-Length Range (a Column) Chuckles123[_10_] Excel Programming 1 October 5th 04 05:54 AM
Using a Macro to Sum a Variable-Length Range (a Column) Chuckles123[_9_] Excel Programming 2 October 5th 04 12:34 AM
Using a Macro to Sum a Variable-Length Range (a Column) Chuckles123[_2_] Excel Programming 1 October 3rd 04 11:51 PM
Using a Macro to Sum a Variable-Length Range (a Column) Chuckles123 Excel Programming 2 October 3rd 04 01:12 PM


All times are GMT +1. The time now is 08:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"