在单元格内根据填入的数字自动插入柱形图。而按等差输入数据,则能生成类似的信号图
作者:小林子-Office中国Excel迷你信号图操作动画
1482222928126083.gif
Excel迷你信号图详细VBA代码: Function s(rng As Range) Application.ScreenUpdating = False Application.Volatile On Error Resume Next Set ce = rng(rng.Count).Offset(0, 1)
For Each Shp In ce.Worksheet.Shapes ce.Worksheet.Shapes(ce.Address(, , xlR1C1) & "shape").Delete Next c = rng.Count w = ce.Width h = ce.Height ma = Application.Max(rng) With ce.Worksheet.Shapes For i = 1 To c x1 = ce.Left + 1.1 * w * i / 12 y1 = ce.Top + 0.9 * ce.Height x2 = x1 y2 = ce.Top + ce.Height - rng(i) / ma * 0.9 * h Set Shp = .AddLine(x1, y1, x2, y2) Shp.Name = ce.Address(, , xlR1C1) & "shape" Next End With ActiveSheet.DrawingObjects.Select Selection.ShapeRange.Line.Weight = 3# Selection.ShapeRange.Line.ForeColor.SchemeColor = 17 rng.Offset(1, 1).Select s = "" Application.ScreenUpdating = TrueEnd Function
点击加入群:Excel部落结识Excel大神学好Excel,效率成倍提高,薪水稳步增长,职位快速提升
每天一个源创技巧,如觉得有用,请点上面关注。更重要手机转发分享 |