
セルにコメントを挿入するには、AddCommentメソッドを使います。
例
たとえば、セルB3にコメントを挿入するには次のように記述します。Sub AddCellComment() If TypeName(Range("B3").Comment) <> "Comment" Then Range("B3").AddComment.Text "ハロー" End If End Subこの例では、対象のセルにすでにコメントが挿入されているかをTypeNameを使ってチェックし、未挿入の場合だけAddCommentでコメントを挿入しています。
実行結果

comments powered by Disqus
スポンサーリンク