Excel精英培训网

 找回密码
 注册
查看: 1412|回复: 0

同一列EXCEL数据如何查找相同项

[复制链接]
发表于 2015-4-23 21:36 | 显示全部楼层 |阅读模式
使用宏
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
Dim col As Integer
Dim dic As Object
col = Target.Column
Set dic = CreateObject("scripting.dictionary")
Columns(col).Interior.Color = xlNone
For i = 1 To Cells(65536, col).End(xlUp).Row
    If dic.exists(Cells(i, col).Value) = False Then
        dic(Cells(i, col).Value) = Cells(i, col).Address(0, 0)
    Else
        Range(dic(Cells(i, col).Value)).Interior.Color = vbYellow
        Cells(i, col).Interior.Color = vbYellow
    End If
Next
End Sub

这个是选中列自动高亮列中所有重复项


excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-1 07:51 , Processed in 0.375415 second(s), 8 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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