Hi -
I am having issue with a script that is only able to look at one sheet. When running on another sheet it will not run because it is only selecting a specific sheet. Is there a way to change the below code so it works on the active sheet vs searching for a specific sheet?
One thing to note is that I copied the sheet SFU Chart to Chart #2 on a different tab and I want the script to run on that tab as well, but it won't run....
Code
Sub change_sourceRow()'
' change_sourceRow Makro
Dim Range As String
Dim lastRow, i As Long
Const FIRSTROW = 7
Const NUM_Series = 10
Dim Series(10, 2) As String
'initialize series
Series(1, 1) = "H"
Series(2, 1) = "I"
Series(3, 1) = "J"
Series(4, 1) = "K"
Series(5, 1) = "L"
Series(6, 1) = "M"
Series(7, 1) = "N"
Series(8, 1) = "P"
Series(9, 1) = "Q"
Series(10, 1) = "R"
'Define Range
lastRow = ActiveSheet.Range("C5").Value + FIRSTROW - 1
'Change charts
Sheets("SFU Chart").Select
ActiveSheet.ChartObjects("Diagramm 1").Activate
For i = 1 To NUM_Series
Range = "='sfu chart'!$" & Series(i, 1) & "$" & FIRSTROW & ":$" & Series(i, 1) & "$" & lastRow
ActiveChart.SeriesCollection(i).Values = Range
Next
End Sub
Sub Makro5()
'
' Makro5 Makro
'
'
ActiveChart.SeriesCollection(1).Values = "='sfu chart'!$H$" & FIRSTROW & ":$H$" & lastRow
ActiveChart.SeriesCollection(2).Values = "='sfu chart'!$I$6:$I$" & lastRow
ActiveChart.SeriesCollection(3).Values = "='sfu chart'!$J$6:$J$" & lastRow
ActiveChart.SeriesCollection(4).Values = "='sfu chart'!$K$6:$K$" & lastRow
ActiveChart.SeriesCollection(5).Values = "='sfu chart'!$L$6:$L$" & lastRow
ActiveChart.SeriesCollection(6).Values = "='sfu chart'!$M$6:$M$" & lastRow
ActiveChart.SeriesCollection(7).Values = "='sfu chart'!$N$6:$N$" & lastRow
ActiveChart.SeriesCollection(8).Values = "='sfu chart'!$P$6:$P$" & lastRow
ActiveChart.SeriesCollection(9).Values = "='sfu chart'!$Q$6:$Q$" & lastRow
ActiveChart.SeriesCollection(10).Values = "='sfu chart'!$R$6:$R$" & lastRow
End Sub
Display More