求大神解答
功能,首先提示选取图形中一圆形,遍历与其相同的圆,将圆心坐标获取到Excel中,并对圆形编号。
vba实现,跪谢

解决方案 »

  1.   

    请参考:
    Option Explicit
    Sub SelectAllSameOval()
        Sheet1.Activate
        If LCase$(TypeName(Application.Selection)) <> "oval" Then
            MsgBox "请选中一个圆后再试!"
            Exit Sub
        End If
        Dim Shp As Shape, iW As Single, iH As Single, iNum As Integer
        iW = Selection.Width
        iH = Selection.Height
        iNum = 1
        For Each Shp In Sheet1.Shapes
            With Shp
                If .AutoShapeType = msoShapeOval Then
                    If .Width = iW And .Height = iH Then
                        ''开始编号
                        .TextFrame.Characters.Text = CStr(iNum) & "#"
                        iNum = iNum + 1
                    End If
                End If
            End With
        Next
    End Sub
    '
    .