Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Changing a chart source data in code.

Excel 97.

Can anyone spot where I'm going wrong? I'm trying to
change the source data in code so it only shows upto the
last cell that has a value in it. My code at the mo is..

Dim intActiveCell As Integer
Dim strCell As String
Dim strrange As String

Sheets("Financial Tracker").Select
Range("C13").Select

If ActiveCell < "" Then
Do Until ActiveCell.Value = ""
ActiveCell.Offset(0, 1).Select
Loop
End If
ActiveCell.Offset(0, -1).Select
'Selection.End(xlLeft).Select
strCell = "R" & ActiveCell.Row & "C" & ActiveCell.Column


Sheets("Graphs").Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(3).Values = "='Financial
Tracker'!R13C2: & strCell"


It works fine until the last line where it falls over
with "Object variable......"message. Can this be done in
code?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Changing a chart source data in code.

Charts are a pain, but it looks like you've got a little bug:

ActiveChart.SeriesCollection(3).Values = "='Financial
Tracker'!R13C2: & strCell"

should read (I believe)

ActiveChart.SeriesCollection(3).Values = "='Financial
Tracker'!R13C2:" & strCell

It was evaluating as

='FinancialTracker'!R13C2: & strCell

rather than

='FinancialTracker'!R13C2:R20C2 (or whatever you row/colums were.



--
Message posted from http://www.ExcelForum.com

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
Bar width on existing chart changes when changing source data Robert Brown Charts and Charting in Excel 5 April 30th 10 07:18 PM
Chart changing based on change in data source (number of rows/colu Bal Ram Bhui, Jakarta Charts and Charting in Excel 1 November 16th 08 06:02 AM
Changing Data Source nathan_savidge Excel Worksheet Functions 1 July 17th 08 05:53 PM
How do I view and edit the source code for a Chart in Excel 2003? EBB Charts and Charting in Excel 2 March 21st 07 08:16 PM
Line disappearing from chart after changing data source Albert Charts and Charting in Excel 0 July 12th 06 12:17 PM


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