|
虽然很不想用select的方式,但似乎shapes(array())的方式似乎一直无法成功
- Sub test()
- Dim Dic, Ws, Tmp, S$, Arr, N&, I&
- Set Dic = CreateObject("scripting.dictionary")
- With ThisWorkbook
- For Each Ws In .Worksheets
- With Ws
- .Activate
- For Each Tmp In .Shapes
- S = Tmp.TopLeftCell.MergeArea.Address
- Dic(S) = Dic(S) & vbTab & Tmp.Name
- Next Tmp
- For Each Tmp In Dic.keys
- Arr = Split(Mid(Dic(Tmp), 2), vbTab)
- If UBound(Arr) > LBound(Arr) Then
- .Shapes(Arr(LBound(Arr))).Select
- For I = LBound(Arr) + 1 To UBound(Arr)
- .Shapes(Arr(I)).Select False
- Next I
- Selection.ShapeRange.Group
- End If
- Next Tmp
- End With
- Dic.RemoveAll
- Next Ws
- End With
- Set Dic = Nothing
- End Sub
复制代码 |
|