variable code??

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

variable code 2
Permutations andText to column problem 6
ActiveFormula R1C1 2
Creating a list box 1
find next line for data entry 4
chart settings 2
Adding Chart problem 0
How to allign stacked charts 1

Back
Top