当前位置: 代码迷 >> VBA >> Excel_VBA 设立单元格的字体属性(字体、字号、加粗、斜体、颜色等)
  详细解决方案

Excel_VBA 设立单元格的字体属性(字体、字号、加粗、斜体、颜色等)

热度:4342   发布时间:2013-02-26 00:00:00.0
Excel_VBA 设置单元格的字体属性(字体、字号、加粗、斜体、颜色等)
Public Sub  4_144()
    Dim myRange As Range
    Dim myFont As Font
    Set myRange = Range("A1")    '指定任意的单元格区域
    Set myFont = myRange.Font
    Cells.Clear    '清除工作表数据
    myRange.Value = "ExcelVBA实用技巧大全"
    With myFont
        .Name = "华文新魏"
        .Size = 15
        .Bold = True
        .Italic = True
        .ColorIndex = 3
    End With
    Set myFont = Nothing
    Set myRange = Nothing
End Sub