LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Setting Chart Range

I'm getting an error when trying to set the chart range of a chart.
I've narrowed the problem down and figured out that it occurs when
there is no data in the data range i'm trying to set the chart to.
Any workaround for this?

This is the code i'm using. Chart is activated in a previous set of
code. Columns 1 and 2 (ie x value and series 1 values) always have
data in them. The series 2 column may or may not have data in it, and
may or may not have data in every cell of the range, but I need to set
it anyway. Any ideas on how to fix this problem?

Sub Update_Chart_Ranges(ChartDataRange)
Dim LastRow As Integer
Dim myColumn As Integer, myRow As Integer

LastRow = ChartDataRange.End(xlDown).Row
myColumn = ChartDataRange.Column
myRow = ChartDataRange.Row + 1

ActiveChart.SeriesCollection(1).XValues = "='Actual Chart Data'!R"
& myRow & "C" & myColumn & ":R" & LastRow & "C" & myColumn
ActiveChart.SeriesCollection(1).Values = "='Actual Chart Data'!R"
& myRow & "C" & myColumn + 1 & ":R" & LastRow & "C" & myColumn + 1
ActiveChart.SeriesCollection(2).Values = "='Actual Chart Data'!R"
& myRow & "C" & myColumn + 2 & ":R" & LastRow & "C" & myColumn + 2
End Sub

 
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
Setting the minimum/maximum display range of a chart Babymech Excel Discussion (Misc queries) 3 March 16th 09 11:07 AM
Help setting chart series values with non-continuous range John Hutcins Excel Programming 4 June 19th 07 10:52 PM
Setting chart data range automatically LoucaGreen Excel Programming 4 July 28th 04 02:16 AM
Setting Source Range For Chart James Stephens Excel Programming 4 March 4th 04 11:01 PM
Setting the range in a chart using VB Torben Laursen Excel Programming 1 March 3rd 04 02:16 PM


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