zoukankan      html  css  js  c++  java
  • 单元格设边框

    对C3:E6单元格进行操作。宏的代码如下:  
              Range("C3:E6").Select  
              With   Selection  
                      .HorizontalAlignment   =   xlGeneral  
                      .VerticalAlignment   =   xlBottom  
                      .WrapText   =   False  
                      .Orientation   =   0  
                      .AddIndent   =   False  
                      .ShrinkToFit   =   False  
                      .MergeCells   =   True  
              End   With  
              Selection.Borders(xlDiagonalDown).LineStyle   =   xlNone  
              Selection.Borders(xlDiagonalUp).LineStyle   =   xlNone  
              With   Selection.Borders(xlEdgeLeft)  
                      .LineStyle   =   xlContinuous  
                      .Weight   =   xlThin  
                      .ColorIndex   =   xlAutomatic  
              End   With  
              With   Selection.Borders(xlEdgeTop)  
                      .LineStyle   =   xlContinuous  
                      .Weight   =   xlThin  
                      .ColorIndex   =   xlAutomatic  
              End   With  
              With   Selection.Borders(xlEdgeBottom)  
                      .LineStyle   =   xlContinuous  
                      .Weight   =   xlThin  
                      .ColorIndex   =   xlAutomatic  
              End   With  
              With   Selection.Borders(xlEdgeRight)  
                      .LineStyle   =   xlContinuous  
                      .Weight   =   xlThin  
                      .ColorIndex   =   xlAutomatic  
              End   With  
              Selection.Borders(xlInsideVertical).LineStyle   =   xlNone  
              Selection.Borders(xlInsideHorizontal).LineStyle   =   xlNone  
      -----------------------------------------------------------  
      然后就是找出其中需要的代码,并进行修改。  
      假设我定义了一个xlsSheet对象,那么代码可以修改如下:  
              xlsSheet.Range("C3:E6").MergeCells   =   True         '//合并单元格  
              '//下面是设置边框  
              With   xlsSheet.Range("C3:E6").Borders(7)         'xlEdgeLeft  
                      .LineStyle   =   1         'xlContinuous  
                      .Weight   =   2         'xlThin  
                      .ColorIndex   =   -4105         'xlAutomatic  
              End   With  
              With   xlsSheet.Range("C3:E6").Borders(8)         'xlEdgeTop  
                      .LineStyle   =   1  
                      .Weight   =   2  
                      .ColorIndex   =   -4105  
              End   With  
              With   xlsSheet.Range("C3:E6").Borders(9)         'xlEdgeBottom  
                      .LineStyle   =   1  
                      .Weight   =   2  
                      .ColorIndex   =   -4105  
              End   With  
              With   xlsSheet.Range("C3:E6").Borders(10)         'xlEdgeRight  
                      .LineStyle   =   1  
                      .Weight   =   2  
                      .ColorIndex   =   -4105  
              End   With  

  • 相关阅读:
    CSS 3列等高
    CSS分列等高
    jQuery函数
    JQuery解析JSON数据
    2020-09-25:rust中Point是结构体类型,【let p1=Point{x:25,y:25};let p2=p1;】请问p1和p2是同一个对象吗?
    2020-09-24:jvm监控系统是通过jmx做的么?
    2020-09-23:TCP头部信息有哪些?
    2020-09-22:已知两个数的最大公约数和最小公倍数,并且这两个数不能是最大公约数和最小公倍数本身。如何判断这两个数是否存在?
    2020-09-21:已知最大公约数和最小公倍数,如何判断这两个数是否存在?
    2020-09-20:如何判断一个数是质数?
  • 原文地址:https://www.cnblogs.com/itecho/p/1340088.html
Copyright © 2011-2022 走看看