Академический Документы
Профессиональный Документы
Культура Документы
1. On the worksheet that contains the sample data, select the cell range B1:C6.
2. In Microsoft Office Excel 2003 and in earlier versions of Excel, follow these
steps:
1. Click Chart on the Insert menu.
2. In the Chart Wizard - Step 1 of 4 - Chart Type dialog box, click the
Standard Types tab. Under Chart type, click XY (Scatter), and then click
Next.
3. In the Chart Wizard - Step 2 of 4 - Chart Source Data dialog box, click
the Data Range tab. Under Series in, click Columns, and then click Next.
4. In the Chart Wizard - Step 3 of 4 - Chart Options dialog box, click
Next.
5. In the Chart Wizard - Step 4 of 4 -Chart Location dialog box, click the
As new sheet option, and then click Finish.
In Microsoft Office Excel 2007, follow these steps:
6. Click the Insert tab, click Scatter in the Charts group, and then select a
type.
7. On the Design tab, click Move Chart in the Location group, click New
sheet , and then click OK.
3. Press ALT+F11 to start the Visual Basic Editor.
4. On the Insert menu, click Module.
5. Type the following sample code in the module sheet:
6.
7. Sub AttachLabelsToPoints()
8.
9.
'Dimension variables.
10.
Dim Counter As Integer, ChartName As String, xVals As String
11.
12.
' Disable screen updating while the subroutine is run.
13.
Application.ScreenUpdating = False
14.
15.
'Store the formula for the first series in "xVals".
16.
xVals = ActiveChart.SeriesCollection(1).Formula
17.
18.
'Extract the range for the data from xVals.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
ActiveChart.SeriesCollection(1).Points(Counter).DataLabel.Text = _
Range(xVals).Cells(Counter, 1).Offset(0, -1).Value
Next Counter
31.
32.
33.
End Sub