Expanding Data Range based on variable

2019-08-14 19:12发布

I am attempting to get the data range of my table to update based on a varialbe. My code is:

Sub outputupdatescale()  
Dim workdayCol As String  
    Worksheets("Summary").Activate  
    workdayCol = Cells(2, "F").Value  

    Sheets("Output").Select
    ActiveSheet.ChartObjects("Chart 9").Activate
    ActiveChart.PlotArea.Select
    ActiveChart.FullSeriesCollection(1).Values = "='2014 actual'!$C$54:workdayCol&54"
    ActiveChart.FullSeriesCollection(2).Values = "='2014 actual'!$C$56:workdayCol&56"
End Sub

However I get a 1004 error on running.

I know the issue is with how I am inputting my variable I just can't think of what to try next. Also I assume there is a far easier way to do it so would be very grateful of any help

标签: excel vba
0条回答
登录 后发表回答