K
Katherine
I've written the following code to create a chart on the active sheet.
'Select the range of data to chart (using the value from FindLastUsedRow)
Range(Cells(2, 1), Cells(intLastRow, 7)).Select
'Create the chart
With ActiveSheet.ChartObjects.Add(Left:=100, Width:=375, Top:=75,
Height:=255).Chart
.SetSourceData Source:=ActiveSheet.Range(Cells(2, 1), Cells(intLastRow,
7))
.ChartType = xlColumnClustered
.Axes(xlValue).MajorUnit = 1
End With
Two questions....
1) How can I check for the presence of a chart on the active sheet? The idea
is that the user clicks the button to initially create and then update the
chart, and I figured deleting and redrawing it would be the way to do this. I
need to be able to check if the chart on that sheet has already been created
and, if so, delete it.
2) Can someone explain to me the units of measurement that decide
whereabouts in the sheet the chart is placed? I got the (Left:=100,
Width:=375, Top:=75, Height:=255) above from the macro recorder, which is all
well and good but I don't understand exactly how it works.
Any suggestions greatly appreciated
'Select the range of data to chart (using the value from FindLastUsedRow)
Range(Cells(2, 1), Cells(intLastRow, 7)).Select
'Create the chart
With ActiveSheet.ChartObjects.Add(Left:=100, Width:=375, Top:=75,
Height:=255).Chart
.SetSourceData Source:=ActiveSheet.Range(Cells(2, 1), Cells(intLastRow,
7))
.ChartType = xlColumnClustered
.Axes(xlValue).MajorUnit = 1
End With
Two questions....
1) How can I check for the presence of a chart on the active sheet? The idea
is that the user clicks the button to initially create and then update the
chart, and I figured deleting and redrawing it would be the way to do this. I
need to be able to check if the chart on that sheet has already been created
and, if so, delete it.
2) Can someone explain to me the units of measurement that decide
whereabouts in the sheet the chart is placed? I got the (Left:=100,
Width:=375, Top:=75, Height:=255) above from the macro recorder, which is all
well and good but I don't understand exactly how it works.
Any suggestions greatly appreciated