惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Cloudbric
Cloudbric
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tenable Blog
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

博客园 - 张荣华

摩托车买车学车流水账 我的2016年 AutoHotKey实现将站点添加到IE的Intranet本地站点 如何通过***自动更新Chrome - 张荣华 写给大家看的设计书 VSS每次打开都需要服务器账号和密码的解决方法 好的工作习惯 某CRM项目招投标工作的感悟 读书笔记---PMBOK第五版官方中文版 善用佳软,打造高效率的办公环境 怎么在Microsoft Project中冻结列 我的家庭保险方案推荐 如何修改Total Commander配件文件的位置 豆瓣统计-2015 读书笔记---《火球:UML大战需求分析》 博客编写客户端分享 IT人员如何保护视力 SublimeText3下的Python开发环境配置 从Evernote迁移到Wiz 读书笔记---《即学即用财务常识120例》
如何在Excel中通过VBA快速查找多列重复的值
张荣华 · 2016-07-20 · via 博客园 - 张荣华

今天项目组的一个同事问我如何快速的找到一个Excel中第3列和第5列的值完全重复的值,我想了想虽然Excel中自带查找重复值的功能,但是好像只能对同一列进行比较,所以就写了一个VBA进行处理,VBA非常简单,但效果不错。

Sub FindDuplicatesInColumn()

    Dim lastRow As Long
    Dim matchFoundIndex As Long
    Dim iCntr As Long
    lastRow = 500
    
    ' 初始化临时列, 第7列用来存放结果,第8列将3 5两列的值拼接起来,方便判断
    For iCntr = 2 To lastRow
        Cells(iCntr, 7) = ""
        Cells(iCntr, 8) = Cells(iCntr, 3) & Cells(iCntr, 5)
    Next iCntr
    
    For iCntr = 2 To lastRow
        If Cells(iCntr, 5) <> "" Then
            ' 判断是否存在相等的拼接后的列,如果存在,则记录到结果中
            matchFoundIndex = WorksheetFunction.Match(Cells(iCntr, 8), Range("H1:H" & lastRow), 0)
            If iCntr <> matchFoundIndex Then
                Cells(iCntr, 7) = "Duplicate with " & matchFoundIndex
            End If
        End If
    Next iCntr
End Sub