|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim r%, i%
- Dim arr, brr
- With Worksheets("sheet1")
- For Each shp In .Shapes
- If shp.Type = 1 Then
- shp.Delete
- End If
- Next
- r1 = .Cells(.Rows.Count, 1).End(xlUp).Row
- r2 = .Cells(.Rows.Count, 4).End(xlUp).Row
- For i = 2 To r1
- For j = 2 To r2
- If .Cells(i, 1) = .Cells(j, 4) Then
- .Shapes.AddConnector msoConnectorStraight, .Cells(i, 2).Left, .Cells(i, 2).Top + .Cells(i, 2).Height / 2, .Cells(j, 4).Left, .Cells(j, 4).Top + .Cells(j, 4).Height / 2
- End If
- Next
- Next
- End With
- End Sub
复制代码 |
|