Font.Name:表示するフォントを設定する

Excel VBA リファレンス

スポンサードリンク

表示するフォントを設定する

サンプルコード
Option Explicit

'このプロシージャから実行してください。
Sub main()
  '現在のフォントを取得する
  With Worksheets("Sheet1")
    Debug.Print ("現在のフォントは" & Cells(1, 1).Font.Name)
  End With
  
  '現在のフォントを設定する
  With Worksheets("Sheet1")
    Cells(1, 1).Font.Name = "MS 明朝"
    Cells(1, 1).Value = "Excel VBA"
    
    Cells(2, 1).Font.Name = "MS Pゴシック"
    Cells(2, 1).Value = "Excel VBA"
    
    Cells(3, 1).Font.Name = "MS Hei"
    Cells(3, 1).Value = "Excel VBA"
    
    Cells(4, 1).Font.Name = "Arial"
    Cells(4, 1).Value = "Excel VBA"
  End With

  '現在のフォントを取得する
  With Worksheets("Sheet1")
    Debug.Print ("現在のフォントは" & Cells(1, 1).Font.Name)
  End With
End Sub

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