|
发表于 2016-6-11 14:50
|
显示全部楼层
本楼为最佳答案
- Sub 画线()
- Dim x As Double, x1 As Double, y As Double, n&, i&, d1%, d2%
- With Sheet1
- n = .Cells(.Rows.Count, 1).End(xlUp).Row - 1
- .DrawingObjects.Delete
- For i = 5 To n
- d1 = Day(.Range("E" & i))
- d2 = Day(.Range("F" & i))
- x = .Cells(i, d1 + 7).Left
- y = .Cells(i + 1, d1 + 7).Top - .Cells(i + 1, d1 + 7).Height / 2
- x1 = .Cells(i, d2 + 8).Left
- .Shapes.AddConnector(msoConnectorStraight, x, y, x1, y).Select
- With Selection.ShapeRange.Line
- .ForeColor.RGB = RGB(0, 0, 0)
- .Weight = 6
- End With
- Next
- End With
- End Sub
复制代码 |
|