Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 2119|回复: 3

[已解决]请高手优化关于加边框的代码。在线等,急。。。。。

[复制链接]
发表于 2010-10-30 12:55 | 显示全部楼层 |阅读模式
 m = Target.Row
   Range(Cells(m, 1), Cells(m + 18, 7)).Select
        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
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
最佳答案
2010-10-30 13:02

Selection.Borders.LineStyle = True

with 后面的可以换为一句。

excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2010-10-30 13:02 | 显示全部楼层    本楼为最佳答案   

Selection.Borders.LineStyle = True

with 后面的可以换为一句。

回复

使用道具 举报

 楼主| 发表于 2010-10-30 13:11 | 显示全部楼层

谢谢楼上的老师,假如我要使这段代码对整个工作薄有效,该添加啥事件呢?
回复

使用道具 举报

发表于 2010-10-30 13:22 | 显示全部楼层

[em09][em09][em09]

放在Thisworkbook里面?

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-16 14:55 , Processed in 0.139121 second(s), 7 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表