excel实现鼠标用不同颜色十字定位表格 - 图文
更新时间:2023-10-07 13:31:01 阅读量: 综合文库 文档下载
- EXCEL鼠标无法编辑了推荐度:
- 相关推荐
excel实现鼠标用不同颜色定位表格
参考文档:http://jingyan.http://m.wodefanwen.com//article/375c8e198cf51525f3a22966.html 实现鼠标十字定位目标,效果见下图:
由于长期需要用excel进行数据录入,当excel数据一多,经常由于行和列的问题会看错。为了避免这种情况。就想到用用下面的办法解决这个问题
1.实现的效果就是鼠标点到那,都有一个不同的颜色区分出,鼠标所在位置的行和列
2.我用的版本是office 2010,打开excel,新建如下图。 3.在sheet1下标签处,点击鼠标右键,出现如下图 4.选择查看代码
5.看到如下界面,插入如下代码
Code1 (office2010版本可用,office2007未测试) Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) On Error Resume Next Cells.FormatConditions.Delete iColor =39 With Target.EntireRow.FormatConditions .Delete .Add xlExpression, , \ .Item(1).Interior.ColorIndex = iColor End With With Target.EntireColumn.FormatConditions .Delete .Add xlExpression, , \ .Item(1).Interior.ColorIndex = iColor End With End Sub
注:iColor = 34(绿色) 38(粉色)6(黄色) iColor =39 紫色
Code2 (office2010版本可用,office2007未测试) 该代码可实现横竖是两种不同颜色,但是原表格底色变成白色 Private Sub Worksheet_SelectionChange(ByVal Target As Range) Rows.Interior.ColorIndex = 0 Rows(Target.Row).Interior.ColorIndex = 39 Columns(Target.Column).Interior.ColorIndex = 42 End Sub
Code3 (office2010版本不可用,office2007未测试) Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Count> 1 Then Exit Sub If Target.Column>= 9 And Target.Column<= 48 Then With Target.Interior If .ColorIndex = 3 Then .ColorIndex = xlNone Else .ColorIndex = 3 .Pattern = xlSolid .PatternColorIndex = xlAutomatic End If End With End If If Target.Column>= 50 And Target.Column<= 67 Then With Target.Interior If .ColorIndex = 5 Then .ColorIndex = xlNone Else .ColorIndex = 5 .Pattern = xlSolid .PatternColorIndex = xlAutomatic End If End With End If End Sub
Code4 (office2010版本可用,office2007未测试) Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) On Error Resume Next Cells.FormatConditions.Delete iColor = Int(50 * Rnd() + 2) With Target.EntireRow.FormatConditions .Delete .Add xlExpression, , \.Item(1).Interior.ColorIndex = iColor End With With Target.EntireColumn.FormatConditions .Delete .Add xlExpression, , \.Item(1).Interior.ColorIndex = iColor End With End Sub
Code5 (office2010版本可用,office2007未测试) Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) On Error Resume Next Cells.FormatConditions.Delete 'iColor = Int(50 * Rnd() + 2) iColor = 34 With Target.EntireRow.FormatConditions .Delete .Add xlExpression, , \ .Item(1).Interior.ColorIndex = iColor End With
正在阅读:
excel实现鼠标用不同颜色十字定位表格 - 图文10-07
盾构掘进特殊地段的施工方案 - 图文04-15
这个我也行作文700字06-16
多媒体技术理论教案 - 副本05-28
东坡肉的故事作文800字06-12
一句禅语一种人生02-19
简短恐怖吓人的小故事5篇03-24
实验二进程调度09-26
- 清真菜谱
- 我国国民经济和社会发展十二五规划纲要(全文)
- 高三物理机械振动和机械波复习2
- 浙江省公路山岭隧道机械化装备应用指导手册 doc - 图文
- 2018届高三数学文科二轮复习:专题检测(九) 导数的简单应用
- 2015年上海市公务员录用考试《行政职业能力测验》试卷(B类)
- 七年级道德与法制下册
- 大班户外游戏教案
- 病虫害预警 - 图文
- 某养鱼场为了提高经营管理水平
- 汉中市勉县尧柏余热汽机规程 10
- 烹饪试卷
- 事业单位考试公共基础知识专项分类题库训练
- 语文:第2课 走一步,再走一步 课堂导学案(人教版 七上)
- 天汉使用手册
- 人教版小学三年级数学下册教学计划
- 房地产销售管理完全操作手册122页
- 2009年评审通过具有中学高级教师专业技术资格人员名单...
- 《15秋公共关系学》作业1
- 2017最新版监理公司三标一体管理手册
- 十字
- 表格
- 鼠标
- 定位
- 颜色
- 不同
- 实现
- 图文
- excel
- 辽宁大连的寺庙大全
- 知识竞赛 - 系解竞赛题目
- 宁夏石嘴山市第三中学2019届高三下学期一模考试理科综合试题
- 第二章 变压器习题
- 计算机图形学考试题目答案
- 用状态机设计的TLC1196采样控制电路
- 综合实验 介孔氧化硅SBA-15的水热法合成(1)
- 东大19春学期《机械设计》在线作业3
- 部编新人教版七年级历史下册知识点汇总
- 山水城市中的公共空间营建 - 图文
- 单兵外骨骼装备技术简介 - 图文
- 2017-2018新人教版5五年级数学上册全册教案
- 魏晋南北朝诗歌下作业题
- 2017-2018学年高二第一学期期末考试英语试卷
- 校本教研活动记录表
- 以新生教育工程为抓手 提高学生教育与管理工作上水平
- 高一职业生涯规划期中考试题
- 河道清淤及所需资料1
- 用电脑蓝牙连接手机上网最好不过啦 别后悔哦
- C语言模拟试卷2(带答案)