Excel精英培训网

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

[已解决]求:指定区域显示高亮代码改下?

[复制链接]
发表于 2017-6-26 16:23 | 显示全部楼层 |阅读模式
如题,见附件。
谢谢各位大侠老师的帮助!!!


求:指定区域显示高亮代码改下?.rar (88.53 KB, 下载次数: 17)
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2017-6-26 16:39 | 显示全部楼层    本楼为最佳答案   
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  2.     Cells.Interior.ColorIndex = xlNone
  3.     If Target.Row <= 29 And Target.Column <= 5 Then
  4.         Columns(Target.Column).Range("a1:a29").Interior.ColorIndex = 15
  5.         Cells(Target.Row, Target.Column).Interior.ColorIndex = 22
  6.     ElseIf Target.Row <= 29 And Target.Column <= 12 And Target.Column > 7 Then
  7.         Columns(Target.Column).Range("a1:a29").Interior.ColorIndex = 15
  8.         Cells(Target.Row, Target.Column).Interior.ColorIndex = 22
  9.     End If
  10.     Rows(Target.Row).Range("a1:e1").Interior.ColorIndex = 6
  11.     Rows(Target.Row).Range("h1:l1").Interior.ColorIndex = 6
  12. End Sub
复制代码

评分

参与人数 1 +3 收起 理由
fxgg72 + 3 赞一个

查看全部评分

回复

使用道具 举报

发表于 2017-6-26 17:08 | 显示全部楼层
大灰狼老师在点击  F  G  两列是  也会高亮显示当前行

你是要那种效果  ,左边和右边不一样 ,区别在于 F 和 G 列是否也高亮。。

01.gif
回复

使用道具 举报

 楼主| 发表于 2017-6-27 13:12 | 显示全部楼层
02761752696 发表于 2017-6-26 17:08
大灰狼老师在点击  F  G  两列是  也会高亮显示当前行

你是要那种效果  ,左边和右边不一样 ,区别在于  ...

老师您好!
左边和右边是一样的。
就是不管点击左边还是右边,F、G列都不要高亮;点左边,右边也要显示出来,点右边,左边也要显示出来。
谢谢!
回复

使用道具 举报

发表于 2017-6-27 17:33 | 显示全部楼层
fxgg72 发表于 2017-6-27 13:12
老师您好!
左边和右边是一样的。
就是不管点击左边还是右边,F、G列都不要高亮;点左边,右边也要显示 ...

那就是点击左边的效果,对不?F G 列不高亮?
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-27 10:21 , Processed in 0.357862 second(s), 14 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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