excel2007散点图添加文字标签的操作流程
时间:2022-10-26 17:31
很多用户在使用excel2007散点图添加文字标签的时候,不是很熟悉其中怎么添加文字标签?本期为你们带来的教程就描述了excel2007散点图添加文字标签的操作流程。
excel2007散点图添加文字标签的操作流程
打开数据集,选择数值型数据,插入“散点图”,即获得该数据集的图形。

excel直接获得的散点图比较展示效果不太理想,需手动做一些调整。选择水平坐标轴,邮件,选择“设置坐标轴格式”,将坐标轴选项的最小值调整为1.5,最大值调整为2.0。同样的对纵轴也进行同样的设置,效果见下图。



由于Excel不能直接添加标签,我们需要自己编写宏来完成这个过程。因为这儿有供参考的添加气泡图系列文本标签,先将图表类型更改为气泡图。

按“Alt+F11“键,打开VBA编辑器。
输入下列代码:
Sub AddLabel()
'为气泡图数据系列添加文本数据标签'
Dim rRng As Range
Dim i As Integer
On Error GoTo line1
Set rRng = Application.InputBox("选择包含数据标签的列区域", Title:="选择区域", Type:=8)
Selection.ApplyDataLabels
For i = 1 To rRng.Rows.Count
Selection.Points(i).DataLabel.Text = rRng.Item(i).Text
Next i
line1:
End Sub
代码输入完后,点击运行按钮,出现”选择包含数据标签的列区域“提示框。


在提示框内选择文本数据值,点击确定,

这时,再将数据类型更改为散点图。点击确定。完成。


上面就是小编为大家带来的excel2007散点图添加文字标签的操作流程,一起来学习学习吧。相信是可以帮助到一些新用户的。