office交流網(wǎng)--QQ交流群號(hào)及微信交流群

Access培訓(xùn)群:792054000         Excel免費(fèi)交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

微信交流群(請(qǐng)用微信掃碼)

        

選中當(dāng)前激活單元格里的圖形(形狀)Shape

2020-06-06 08:00:00
zstmtony
原創(chuàng)
5331

使用以下代碼可以 選中當(dāng)前激活單元格里的圖形(形狀)Shape


Sub SelectPictureAtActiveCell()
  Dim Pic As Shape
  For Each Pic In ActiveSheet.Shapes
    If Pic.TopLeftCell.Address = ActiveCell.Address Then
      If Pic.Type = msoPicture Then
        Pic.Select
        Exit For
      End If
    End If
  Next
End Sub


其它可參考代碼

Sub SelectPic()
Dim Pic As Picture
For Each Pic In ActiveSheet.Pictures
       If Pic.Name = "Picture 1" Then
              Pic.Left = ActiveCell.Left
              Pic.Top = ActiveCell.Top
       End If
       If Pic.Left = ActiveCell.Left And Pic.Top = ActiveCell.Top Then
              Pic.Select
              MsgBox Pic.Name
       End If
Next Pic
End Sub

分享
文章分類
聯(lián)系我們
聯(lián)系人: 王先生
Email: 18449932@qq.com
QQ: 18449932
微博: officecn01
移動(dòng)訪問