SSブログ

Excel2000 VBA コメントの表示、非表示 [Excel2000 VBA独習]

Excel2000 VBA コメントの表示、非表示

マクロの記録でコメント欄を なし、コメントマークのみ 、コメントとコメントマークに切り替えて記録して実行したけど、想定した動作にならなかったので、下記のマクロを作成

Sub コメント表示非表示()
'
'表示しない、マークだけ、表示 に切り替える
'
    If Application.DisplayCommentIndicator = xlNoIndicator Then Application.DisplayCommentIndicator = xlCommentIndicatorOnly: Exit Sub
    If Application.DisplayCommentIndicator = xlCommentIndicatorOnly Then Application.DisplayCommentIndicator = xlCommentAndIndicator: Exit Sub
    If Application.DisplayCommentIndicator = xlNoIndicator Then Application.DisplayCommentIndicator = xlNoIndicator Else Application.DisplayCommentIndicator = xlNoIndicator
   
End Sub

 「Application.DisplayCommentIndicator」検索したら、下記のURLにマクロがあった
   ttp://seadragon.info/excelvba/excel_library1_3.htm
自分が書いたマクロより、当然goodなのでこちらのマクロを採用(if じゃなくてSelect Caseを使うのだょ!)

 Sub コメントを表示非表示()
'コメントを表示しない、マークだけ、表示、と切り替えます
    Select Case Application.DisplayCommentIndicator
        Case xlNoIndicator
            Application.DisplayCommentIndicator = xlCommentIndicatorOnly
        Case xlCommentIndicatorOnly
            Application.DisplayCommentIndicator = xlCommentAndIndicator
        Case xlCommentAndIndicator
            Application.DisplayCommentIndicator = xlNoIndicator
        Case Else
            Application.DisplayCommentIndicator = xlNoIndicator
    End Select
End Sub

コメント欄の背景色を変える

  1. コメントのあるセルで右クリック「コメントの編集」をクリック
  2. 枠の部分を選択して右クリック、コメントの書式設定をクリック
  3. 塗りつぶし色で変更
excel_VBA_comment..jpg
  1.  

タグ:Excel2000 VBA
nice!(0)  コメント(0)  トラックバック(0) 
共通テーマ:パソコン・インターネット

nice! 0

コメント 0

コメントを書く

お名前:
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

トラックバック 0

この広告は前回の更新から一定期間経過したブログに表示されています。更新すると自動で解除されます。