单元格格式设置VBA代码 一、字体设置
With Selection.Font
.Name = "华文楷体" .FontStyle = "常规" .Size = 20 End With
附录:其他一些属性
.Strikethrough = False '删除线 .Superscript = False '上标 .Subscript = False '下标 .OutlineFont = False '上标
.Shadow = False '阴影
.Underline = xlUnderlineStyleNone '下划线 二、水平和垂直居中
With Selection
.HorizontalAlignment = xlCenter '水平对齐方式 rem xlLeft 左对齐 xlRight 右对齐 xlCenter 居中对齐 .VerticalAlignment = xlCenter '竖直对齐方式 rem xlTop 靠上 xlCenter 居中 xlBottom 靠下 .WrapText = True '自动换行 .MergeCells = True '合并单元格