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  

  • 相关阅读:
    Jquery.validate.js表单验证插件的使用
    UEditor编辑文章出现多余空行问题的解决办法
    jQuery问题:$XXX is not a function
    PHP+memcache扩展(集成环境wampserver环境下)
    Provider 错误 '80004005' 未指定的错误 /conn.asp,行 23
    PHP+MD5
    Mysql(Mariadb) 基础操作语句 (持续更新)
    什么是存储引擎以及不同存储引擎特点
    微信网页授权(OAuth2.0) PHP 源码简单实现
    字符集和字符集编码详解
  • 原文地址:https://www.cnblogs.com/itecho/p/1340088.html
Copyright © 2011-2022 走看看