当前位置:编程学习 > VB >>

怎样用VB使EXCEL中某一sheet所有单元格的字体居中、大小为10、颜色为黑色?

如题:
怎样用VB使EXCEL中某一sheet所有单元格的字体居中、大小为10、颜色为黑色?
    Cells.Select
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlCenter
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    With Selection.Font
        .Name = "宋体"
        .Size = 10
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
    End With
    Selection.Font.ColorIndex = 1

Sheet1.Cells.Font.Size = 20
Sheet1.Cells.HorizontalAlignment = 3
Sheet1.Cells.Font.ColorIndex = 0
OK~~ 谢谢~~ 在Excel里录个宏,直接复制粘贴过去就能用.. +1。宏录制太有用了.
引用 4 楼 dazhi518 的回复:
在Excel里录个宏,直接复制粘贴过去就能用..
请问怎么录制宏呢?小弟刚学VB 不太懂,特请指教~~ 新问题新帖子
打开Word或Excel从菜单里可以找到

引用 6 楼 qingzai123123 的回复:
请问怎么录制宏呢?小弟刚学VB 不太懂,特请指教~~
引用 6 楼 qingzai123123 的回复:
请问怎么录制宏呢?小弟刚学VB 不太懂,特请指教~~

这个...录制宏跟学没学VB关系不大
补充:VB ,  基础类
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,