Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Programmatically using Range to update chart

I am not sure what WS.Cells(12, i).Value equates to, nor what the variable
query equates to, but I do know the if you use Range(anyVariable) then
anyVariable has to equate to a range address, e.g. "A1:B4" or something
similar. If you are trying to use it with the variable "query" equating to
an integer or set of integers, it won't work.

"royend" wrote:

Hi.
I am trying to control my graph programmatically and it seems I need
to use a Range somehow. My code so far:
-----
Sub UpdateReport()
Dim query As String
Dim WS As Worksheet

Set WS = Worksheets("Oppsummering - kroner")

End = 2 * [B2]
Period = 2 * [B3]

For i = End - Period To End
If (i = End - Period) Then 'first cell added to range
query = WS.Cells(12, i).Value
Else
query = query & "," & WS.Cells(12, i).Value
End If
Next i

ActiveSheet.ChartObjects("Diagram 3").Activate
ActiveChart.SeriesCollection(1).XValues = _
Range(query)
ActiveChart.SeriesCollection(1).Values = _
Range(query)
End Sub
-----

Why doesn't it work?
The range consist of values seperated by ",".
e.g: "120, 100, 80, 100"

Looking forward to your help...


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
Cannot Update Chart Data Range! Tfrup12 Excel Discussion (Misc queries) 0 February 10th 09 01:58 PM
trying to programmatically change chart data range with vb.net doofy[_2_] Charts and Charting in Excel 7 February 8th 08 02:02 PM
Update Chart data Range with VBA Roger Charts and Charting in Excel 1 April 10th 05 02:07 PM
Update Chart data Range with VBA Roger[_18_] Excel Programming 1 April 10th 05 02:07 PM
Dynamic Chart Range and Chart Update ExcelMonkey[_154_] Excel Programming 1 July 6th 04 08:26 PM


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