Font.Strikethrough:フォントを取消線設定する

Excel VBA リファレンス

スポンサードリンク

フォントを取消線設定する

サンプルコード
Option Explicit

'このプロシージャから実行してください。
Sub main()
  'セルのフォント装飾設定を取得する
  With Worksheets("Sheet1")
    Debug.Print ("太字設定は" & Cells(1, 1).Font.Bold)
    Debug.Print ("斜体設定は" & Cells(1, 1).Font.Italic)
    Debug.Print ("下線設定は" & Cells(1, 1).Font.Underline)
    Debug.Print ("取消線設定は" & Cells(1, 1).Font.Strikethrough)
  End With
  
  'セルのフォント装飾設定を設定する
  With Worksheets("Sheet1")
    Cells(1, 1).Font.Bold = True
    Cells(1, 1).Value = "エクセル VBA"
    
    Cells(2, 1).Font.Italic = True
    Cells(2, 1).Value = "エクセル VBA"
    
    Cells(3, 1).Font.Underline = True
    Cells(3, 1).Value = "エクセル VBA"
    
    Cells(4, 1).Font.Strikethrough = True
    Cells(4, 1).Value = "エクセル VBA"
  End With

  'セルのフォント装飾設定を取得する
  With Worksheets("Sheet1")
    Debug.Print ("太字設定は" & Cells(1, 1).Font.Bold)
    Debug.Print ("斜体設定は" & Cells(1, 1).Font.Italic)
    Debug.Print ("下線設定は" & Cells(1, 1).Font.Underline)
    Debug.Print ("取消線設定は" & Cells(1, 1).Font.Strikethrough)
  End With
End Sub

処理結果
フォントの装飾(取消線設定)
スポンサードリンク
関連カテゴリー
フォント操作 / 関数・ステートメント索引(F)