使用sparklines处理迷你图组的属性

上传人:自*** 文档编号:79215693 上传时间:2019-02-16 格式:DOCX 页数:3 大小:68.92KB
返回 下载 相关 举报
使用sparklines处理迷你图组的属性_第1页
第1页 / 共3页
使用sparklines处理迷你图组的属性_第2页
第2页 / 共3页
使用sparklines处理迷你图组的属性_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

《使用sparklines处理迷你图组的属性》由会员分享,可在线阅读,更多相关《使用sparklines处理迷你图组的属性(3页珍藏版)》请在金锄头文库上搜索。

1、【e800编译】此示例演示在Microsoft Excel 2010工作簿中如何使用迷你图组的各项属性。此代码段是Office 2010的101项VBA代码示例中的一部分。与其它示例一样,这些将可以直接写入您的代码中。每块示例代码包含约5至50行的代码,分别演示了一个独特的功能或功能集,在VBA或VB以及C中(在Visual Studio 2010中创建)。每个示例之中都会包含代码以及相应注释,这样您就可以直接运行获取预期的结果,或者是根据代码注释提示来调整环境,运行示例代码。Microsoft Office 2010提供了你所需要的工具来创建功能强大的应用程序。Microsoft Visua

2、l Basic Application(VBA)代码示例可以帮助你创建自己的应用程序,以执行特定功能或者以此为出发点实现更为复杂的功能。实例代码在Excel 2010中新建工作簿,并将代码复制到Sheet1类模块。将光标放在WorkWithSparklines,按F8开始调试,然后Shift+ F8单步执行。并列放置VBA和Excel窗口,这样你就可以边运行边查看结果。Sub WorkWithSparklines() Make sure you press Shift+F8 to step over this procedure.FillRandomDataDim rng As RangeSe

3、t rng = Range(C2, N11) Add sparklines to the second columnDim slg As SparklineGroupDim slRng As RangeSet slRng = Range(B2, B11)Set slg = slRng.SparklineGroups.Add(XlSparkType.xlSparkLine, rng.Address)slg.Points.Highpoint.Visible = True Settings for the series:With slg.SeriesColor.ThemeColor = 5.Tint

4、AndShade = 0End With Marker settings:With slg.Points.Markers.Visible = TrueWith .Color.ThemeColor = 6.TintAndShade = 0.5End WithEnd With High point settings:With slg.Points.Highpoint.Visible = TrueWith .Color.ThemeColor = 7.TintAndShade = 0.5End WithEnd With Low point settings:With slg.Points.Lowpoi

5、nt.Visible = TrueWith .Color.ThemeColor = 2.TintAndShade = 0.5End WithEnd With Now change the spark line type:slg.Type = xlSparkColumnEnd SubFunction FillRandomData() As Range No need to stop through this procedure.Dim month As IntegerFor month = 1 To 12Cells(1, month + 2).Value = MonthName(month, True)Next month Fill in rows with random data.Dim i As IntegerDim j As IntegerFor i = 1 To 10Cells(i + 1, 1).Value = Sales & iFor j = 1 To 12Cells(i + 1, j + 2) = Round(Rnd * 100)Next jNext iRange(C1).CurrentRegion.HorizontalAlignment = xlCenterRange(B:B).ColumnWidth = 15End Function

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号