#1   Report Post  
Paul
 
Posts: n/a
Default variable code??

Would appreciate help with what I am doing wrong.. vba
does not like the lines containing the variables for
setting chart parameters:

Sub last1500()

Dim currentrow As Integer
Dim beginrow As Integer

currentrow = Worksheets("data").Range("aa1").Value
beginrow = currentrow - 1500

Application.ScreenUpdating = False

ActiveSheet.ChartObjects("Chart 10").Activate
ActiveChart.SeriesCollection(1).Values = "=DATA!
RbeginrowC5:RcurrentrowC5"
ActiveChart.SeriesCollection(2).Values = "=DATA!
RbeginrowC19:RcurrentrowC19"

End Sub
  #2   Report Post  
Trevor Shuttleworth
 
Posts: n/a
Default

Paul

untested but try something like:

ActiveChart.SeriesCollection(1).Values = _
"=DATA!R" & _
beginrow & _
"C5:R" & _
currentrow & _
"C5"

ActiveChart.SeriesCollection(2).Values = _
"=DATA!R" & _
beginrow & _
"C19:R" & _
currentrow & _
"C19"

Regards

Trevor


"Paul" wrote in message
...
Would appreciate help with what I am doing wrong.. vba
does not like the lines containing the variables for
setting chart parameters:

Sub last1500()

Dim currentrow As Integer
Dim beginrow As Integer

currentrow = Worksheets("data").Range("aa1").Value
beginrow = currentrow - 1500

Application.ScreenUpdating = False

ActiveSheet.ChartObjects("Chart 10").Activate
ActiveChart.SeriesCollection(1).Values = "=DATA!
RbeginrowC5:RcurrentrowC5"
ActiveChart.SeriesCollection(2).Values = "=DATA!
RbeginrowC19:RcurrentrowC19"

End Sub



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
Make Change Case in Excel a format rather than formula Kevin Excel Worksheet Functions 1 March 18th 05 08:53 PM
Error trapped only while stepping through the code - Not triggered when run Jeff Excel Discussion (Misc queries) 7 March 7th 05 06:29 PM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 4th 05 10:50 AM
Opening a file with code without a set file name jenkinspat Excel Discussion (Misc queries) 1 March 3rd 05 03:40 PM
Select sheet with VB code Dunmarie Excel Discussion (Misc queries) 1 January 12th 05 03:44 PM


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