banane78
02-18-2013, 05:01 AM
hi guys,
I would like to change the macro as follows:
I modify the X axis by this code but would like to make it dynamically in terms of defining the last cell "'INPUT SHEET'!R13C1:R23C1"
Since the last cell is not always 23 I want to change it saying search the last cell and use this new range as X axsi label. How can I change the code to get this procedure work?
Private Sub CommandButton1_Click()
Sheets("CHART-Output").Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).XValues = "='INPUT SHEET'!R13C1:R23C1"
ActiveChart.SeriesCollection(2).XValues = "='INPUT SHEET'!R13C1:R23C1"
ActiveChart.SeriesCollection(3).XValues = "='INPUT SHEET'!R13C1:R23C1"
End Sub
I would like to change the macro as follows:
I modify the X axis by this code but would like to make it dynamically in terms of defining the last cell "'INPUT SHEET'!R13C1:R23C1"
Since the last cell is not always 23 I want to change it saying search the last cell and use this new range as X axsi label. How can I change the code to get this procedure work?
Private Sub CommandButton1_Click()
Sheets("CHART-Output").Select
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).XValues = "='INPUT SHEET'!R13C1:R23C1"
ActiveChart.SeriesCollection(2).XValues = "='INPUT SHEET'!R13C1:R23C1"
ActiveChart.SeriesCollection(3).XValues = "='INPUT SHEET'!R13C1:R23C1"
End Sub