E
ElkySS
Is there a way to select a range of cells ONLY if they have data in them
while creating a graph macro. Here is the code I have as of right now:
Sub Try1()
Sheets("Raw Data").Select
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("Raw Data").Range("C252:C256"), _
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="AHT Graph"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
End Sub
Where is says .Range("C252:C256") works this week, but the problem starts in
future weeks. Each week when I add data to my sheet it will add a new number
to the end of that range (I.E. C256 next week) If I just set my range to
C252,C352 then the usable portion of my grid is smashed all the way to the
left with 90 (or so) blank (0, null, what ever you want to call it) plots on
the line graph. This makes it unreadable. What I would like to do is make
my range change as data is added. This macro is tied to a button in excel so
that it can be ran only if need be and will not need to be there all of the
time. Might sound trivial but for as many graphs as I want to make it really
will help out with file size.
while creating a graph macro. Here is the code I have as of right now:
Sub Try1()
Sheets("Raw Data").Select
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("Raw Data").Range("C252:C256"), _
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="AHT Graph"
With ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
End Sub
Where is says .Range("C252:C256") works this week, but the problem starts in
future weeks. Each week when I add data to my sheet it will add a new number
to the end of that range (I.E. C256 next week) If I just set my range to
C252,C352 then the usable portion of my grid is smashed all the way to the
left with 90 (or so) blank (0, null, what ever you want to call it) plots on
the line graph. This makes it unreadable. What I would like to do is make
my range change as data is added. This macro is tied to a button in excel so
that it can be ran only if need be and will not need to be there all of the
time. Might sound trivial but for as many graphs as I want to make it really
will help out with file size.