|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim r%, i%, c%, j%
- With Worksheets("sheet1")
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- For i = 5 To r - 1
- For j = 2 To 12
- If .Cells(i, j) <> "" Then
- Exit For
- End If
- Next
- n1 = j
- For j = 2 To 12
- If .Cells(i + 1, j) <> "" Then
- Exit For
- End If
- Next
- n2 = j
- .Shapes.AddConnector(msoConnectorStraight, .Cells(i, n1).Left + IIf(n1 > n2, 0, .Cells(i, n1).Width), .Cells(i, n1).Top + .Cells(i, n1).Height / 2, .Cells(i + 1, n2).Left + IIf(n1 > n2, .Cells(i + 1, n2).Width, 0), .Cells(i + 1, n2).Top + .Cells(i + 1, n2).Height / 2).Select
- Selection.ShapeRange.Line.EndArrowheadStyle = msoArrowheadTriangle
- With Selection.ShapeRange.Line
- .ForeColor.RGB = RGB(0, 0, 0)
- .Weight = 1.5
- End With
- Next
- End With
- End Sub
- Sub test2()
- With Worksheets("sheet1")
- For Each shp In .Shapes
- shp.Delete
- Next
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|