|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- 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
复制代码 |
|