Excel精英培训网

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

[已解决]红色外边框

[复制链接]
发表于 2017-2-3 10:04 | 显示全部楼层 |阅读模式
红色外边框.rar (5.99 KB, 下载次数: 12)
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2017-2-3 11:11 | 显示全部楼层    本楼为最佳答案   
  1. Sub 宏1()
  2.     With Selection.Borders(xlEdgeLeft)
  3.         .LineStyle = xlContinuous
  4.         .Color = vbRed
  5.         .TintAndShade = 0
  6.         .Weight = xlThin
  7.     End With
  8.     With Selection.Borders(xlEdgeTop)
  9.         .LineStyle = xlContinuous
  10.         .Color = vbRed
  11.         .TintAndShade = 0
  12.         .Weight = xlThin
  13.     End With
  14.     With Selection.Borders(xlEdgeBottom)
  15.         .LineStyle = xlContinuous
  16.         .Color = vbRed
  17.         .TintAndShade = 0
  18.         .Weight = xlThin
  19.     End With
  20.     With Selection.Borders(xlEdgeRight)
  21.         .LineStyle = xlContinuous
  22.         .Color = vbRed
  23.         .TintAndShade = 0
  24.         .Weight = xlThin
  25.     End With
  26.     Selection.Borders(xlInsideVertical).LineStyle = xlNone
  27.     Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  28. End Sub
复制代码
录制的宏
回复

使用道具 举报

发表于 2017-2-3 12:04 | 显示全部楼层
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  2.     On Error Resume Next
  3.     Application.ScreenUpdating = False
  4.     If Target.Count = 1 Then Exit Sub
  5.     With Selection.Borders
  6.         .Color = vbRed
  7.         .Weight = xlThick
  8.     End With
  9.     Selection.Borders(xlInsideVertical).LineStyle = xlNone
  10.     Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
  11.     Application.ScreenUpdating = True
  12. End Sub
复制代码


帖子荒啊,连版主都来凑这个小热闹 :)
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-27 04:29 , Processed in 0.291372 second(s), 11 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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