Charts.Add
With ActiveChart
.ChartType = xlXYScatterLinesNoMarkers
.SetSourceData Source:=gRange, PlotBy:=xlColumns
'next line forces graph to sheet known as gSheet (could be any sheet)
.Location Where:=xlLocationAsObject, name:=gSheet.name
End With
With ActiveChart
.HasTitle = True
.HasLegend = False
.ChartTitle.Characters.Text = dSheet.Cells(1, i + 1)
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
strName = Mid(.name, InStr(.name, "Chart"), 255)
End With
'this is how you resize the chart
'here it's being set to fit a range of cells
With ActiveSheet.Shapes(strName)
.Left = 0
.Top = Range("A" & dRow).Top
.Width = w
.Height = h
End With
With ActiveChart.Axes(xlCategory).TickLabels
.NumberFormat = "dd/mm/yy"
.AutoScaleFont = False
.Font.Size = 8
End With
With ActiveChart.Axes(xlValue).TickLabels
.NumberFormat = "#,##0"
.AutoScaleFont = False
.Font.Size = 8
End With
With ActiveChart.PlotArea
.ClearFormats
.Top = 0
.Left = 0
.Width = w
.Height = h
End With