Hi, I'm very new to VBA and cannot get my code formatted properly to do what I want!
I have this code below that almost works the way I want it to:
ActiveSheet.Shapes.AddChart.Select
Application.ActiveChart.Parent.Name = "StackedChart-PBS"
ActiveChart.ChartType = xlColumnStacked100
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "=""Not Started"""
ActiveChart.SeriesCollection(1).Values = "='Sheet1'!$P$3:$Q$3"
However, I am wanting to define my range with variables so the chart grows and shrinks depending on the amount of data entered in Sheet 1. I know how to define the variables but anytime I use this type of formatting: Sheets(Sheet1).Range(Cells(IIRTStartRow, IIRStartCol), Cells(100, IIREndCol)) to define: 'Sheet1'!$P$3:$Q$3 it doesn't work...
Hope someone understands my problem and can explain how to use variables to define my range..
I have this code below that almost works the way I want it to:
ActiveSheet.Shapes.AddChart.Select
Application.ActiveChart.Parent.Name = "StackedChart-PBS"
ActiveChart.ChartType = xlColumnStacked100
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "=""Not Started"""
ActiveChart.SeriesCollection(1).Values = "='Sheet1'!$P$3:$Q$3"
However, I am wanting to define my range with variables so the chart grows and shrinks depending on the amount of data entered in Sheet 1. I know how to define the variables but anytime I use this type of formatting: Sheets(Sheet1).Range(Cells(IIRTStartRow, IIRStartCol), Cells(100, IIREndCol)) to define: 'Sheet1'!$P$3:$Q$3 it doesn't work...
Hope someone understands my problem and can explain how to use variables to define my range..