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

Hi,

I have a data table where i need to create a chart from.
The data for the chart is in column A (week numbers) and the actual
data is, depending on some situations on column G, or in column N, ...

every chart need the Week column.

I wrote something like (snipset):

Dim ChartWeekSource As Range
Dim ChartDataSource As Range

'Add chart(s)
While Trim(UnitFamilyList(Dummy)) < ""
Windows(datafilename).Activate
Sheets(UnitFamilyName2).Select
Cells(3, MyOffset).Select
ChartTitle = Selection.Offset(-1, -5).Value
Selection.Offset(0, -2).Select
LastRow = Range(Selection, Selection.End(xlDown)).Rows.Count +
2
If LastRow = 65536 Then LastRow = 4
Range(Selection, Cells(LastRow, ActiveCell.Column)).Select
Set ChartWeekSource = Selection
Selection.Offset(0, 2).Select
Range(Selection, Cells(LastRow, ActiveCell.Column)).Select
Set ChartDataSource = Selection
'
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData
Source:=Sheets(ChartSheet).Range(ChartWeekSource, ChartDataSource),
PlotBy:=xlColumns '<<<<<< problem
ActiveChart.Location Whe=xlLocationAsObject, Name:=ChartSheet
ChartNumber = ActiveSheet.Shapes.Count

I get always a run time error 1004 when i set the data source for the
chart (see <<<<<<)

What am i doing wrong?
Regards,
Ludo
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default Dynamic chart problem

On Aug 13, 7:08*am, Ludo wrote:
Hi,

I have a data table where i need to create a chart from.
The data for the chart is in column A (week numbers) and the actual
data is, depending on some situations on column G, or in column N, ...

every chart need the Week column.

I wrote something like (snipset):

* * Dim ChartWeekSource As Range
* * Dim ChartDataSource As Range

'Add chart(s)
* * While Trim(UnitFamilyList(Dummy)) < ""
* * * * Windows(datafilename).Activate
* * * * Sheets(UnitFamilyName2).Select
* * * * Cells(3, MyOffset).Select
* * * * ChartTitle = Selection.Offset(-1, -5).Value
* * * * Selection.Offset(0, -2).Select
* * * * LastRow = Range(Selection, Selection.End(xlDown)).Rows.Count +
2
* * * * If LastRow = 65536 Then LastRow = 4
* * * * Range(Selection, Cells(LastRow, ActiveCell.Column)).Select
* * * * Set ChartWeekSource = Selection
* * * * Selection.Offset(0, 2).Select
* * * * Range(Selection, Cells(LastRow, ActiveCell.Column)).Select
* * * * Set ChartDataSource = Selection
'
* * Charts.Add
* * ActiveChart.ChartType = xlColumnClustered
* * ActiveChart.SetSourceData
Source:=Sheets(ChartSheet).Range(ChartWeekSource, ChartDataSource),
PlotBy:=xlColumns * * *'<<<<<< problem
* * ActiveChart.Location Whe=xlLocationAsObject, Name:=ChartSheet
* * ChartNumber = ActiveSheet.Shapes.Count

I get always a run time error 1004 when i set the data source for the
chart (see <<<<<<)

What am i doing wrong?
Regards,
Ludo


"If desired, send your file to dguillett @gmail.com I will only look
if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results."
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
Dynamic chart problem (re-posted) hoyos Charts and Charting in Excel 3 October 18th 09 03:00 PM
Dynamic chart problem hoyos Charts and Charting in Excel 10 October 17th 09 02:05 AM
Dynamic chart problem hoyos Excel Discussion (Misc queries) 0 October 7th 09 09:46 PM
problem with dynamic data in chart? botha822 Charts and Charting in Excel 1 August 11th 06 02:45 PM
Chart Dynamic Range problem CLR Excel Programming 1 May 18th 05 05:47 PM


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