VBA_单元格格式设置代码

  • 对齐方式选项卡

    With Selection
    .HorizontalAlignment = xlRight 水平对齐方式
    .VerticalAlignment = xlCenter 垂直对齐方式
    .WrapText = False 自动换行
    .Orientation = 0 文字方向
    .AddIndent = False 缩进
    .IndentLevel = 0 缩进量
    .ShrinkToFit = False 缩小字体填充
    .ReadingOrder = xlContext 文字方向
    .MergeCells = False 合并单元格
    End With

    VBA_单元格格式设置代码



·

  • 字体格式选项卡

    With Selection.Font
    .Name = "华文琥珀" 字体
    .Size = 9 字号
    .Strikethrough = False 删除线
    .Superscript = False 上标
    .Subscript = False 下标
    .OutlineFont = False 大纲字体
    .Shadow = False 阴影
    .Underline = xlUnderlineStyleNone 下划线
    .ColorIndex = xlAutomatic 字体颜色
    .TintAndShade = 0 颜色变深或变浅
    .ThemeFont = xlThemeFontNone 主题字体
    End With

VBA_单元格格式设置代码



·

  • 填充色选项卡

    With Selection.Interior
    .Pattern = xlSolid 图案样式
    .PatternColorIndex = xlAutomatic 图案颜色
    .ThemeColor = xlThemeColorDark1 主体颜色
    .TintAndShade = -4.99893185216834E-02 颜色变深或变浅
    .Color = 65535 填充色
    .PatternTintAndShade = 0 对象的淡色和底纹图案
    End With

    VBA_单元格格式设置代码

猜你喜欢

转载自blog.51cto.com/13984984/2470189