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
このサイトはリンクフリーです。リンクを貼る際に連絡は不要です。
© EXCEL VBA リファレンス all rights reserved.