R
royend
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...
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...