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 |
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 |
All times are GMT +1. The time now is 11:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com