VBA學習筆記之添加批註

來源:互聯網
上載者:User

標籤:selection   log   ddc   shape   for   依次   背景   comment   blog   

‘Comment 對象
‘代表儲存格批註

1 Sub 批註添加()2     With [a1]3        If .Comment Is Nothing Then4         .AddComment.Text "123"5         .Comment.Visible = True ‘批註可見6        End If7     End With8 End Sub

添加批註:Range.AddComment.Text 

刪除批註:Range.ClearComments

1 Sub 刪除批註()2 For Each Rng In Selection3 If Not Rng.Comment Is Nothing Then4     Rng.ClearComments5 End If6 Next7 End Sub

重點來了:

1 Sub 大量新增批註()2     For Each Rng In Range("a2:a20")3         Rng.ClearComments ‘不管有沒有批註先刪了,不然之後在原有的批註上添加批註會出錯4         If Rng >= 90 Then Rng.AddComment.Text "優秀"5     Next6 End Sub
 1 Sub 批量將批註增加背景圖() 2 For Each Rng In Selection 3 paths = ThisWorkbook.Path & "\7pic\" & Rng.Value & ".png" ‘根據選擇地區的人名依次匹配對應圖片檔案夾下的圖片 4     Rng.ClearComments 5     Rng.AddComment 6     Rng.Comment.Shape.Height = 50 7     Rng.Comment.Shape.Width = 40 ‘設定批註寬度 8 Rng.Comment.Shape.Fill.UserPicture paths 9 Next10 End Sub

 

VBA學習筆記之添加批註

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.