|
示例如下:
Range("A2:E13").Select '选定单元格
Selection.Font.name = "等线" '单元格字体名称
Selection.Font.Size = 14 '单元格字体大小
Selection.Font.Color = RGB(255, 255, 255) '设置字体颜色
Selection.Font.Bold = True '单元格字体是否为粗体,可以是True或False两个值
Selection.Font.Italic = True '单元格字体是否为斜体,可以是True或False两个值
Selection.Font.Underline = xlUnderlineStyleDouble '单元格字体是否有下划线,取值True、False、xlUnderlineStyleDouble(双)、xlUnderlineStyleSingle(单)
Selection.Font.Strikethrough = True '单元格字体是否有删除线,可以是True或False两个值
Selection.HorizontalAlignment = xlHAlignCenter '水平居中:xlHAlignCenter,靠左:xlHAlignLeft,靠右:xlHAlignRight,默认:xlHAlignGeneral
Selection.VerticalAlignment = xlVAlignCenter '垂直居中:xlVAlignCenter;靠上:xlVAlignTop,靠上:xlVAlignBottom,默认:xlVAlignGeneral
Selection.Interior.Color = RGB(100, 100, 100) '设置背景色
Range("B1:E1").Select '选定单元格
Selection.Resize.Merge '合并单元格
Selection.RowHeight = 20 '行高
Selection.ColumnWidth = 10 '列宽
Selection.Value = "合并了单元格" '单元格赋值 Value也可用 FormulaR1C1 (带公式赋值)
|
|