使用VBA删除重复项 [英] Delete Duplicates with VBA

查看:480
本文介绍了使用VBA删除重复项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我正在尝试编写一个代码,通过表格查看重复项并删除它们。我目前有一个我在旧帖子上找到的代码,以字节为单位,可以正常删除重复项,但我试图找出一种方法,我可以修改它以删除基于标准的重复项。


我一直在尝试更改它,以便如果我有非空的strField(1)和另一个是空的strField(2)和strField(1)是重复的那么删除它。


任何帮助将不胜感激。


谢谢,


Slen


以下是我正在使用的代码(orginally posted by NeoPa)

展开 | 选择 | Wrap | 行号

解决方案

为什么要通过VBA而不是删除查询?

主要是因为我已经建立了代码,在找到重复项之前和之后对表做了一些其他事情。


我试图避免整个dup / append查询然后将该信息拉回主表。


slen:D


那么,你几乎把你所说的翻译成VBA代码

展开 < span class =codeDivider> | 选择 | Wrap | Line编号

Hello,

I am trying to write a code that will look through a table for duplicates and delete them. I currently have a code I found on an older post in bytes that works fine for deleting duplicates but I am trying to figure out a way i can modify it to delete duplicates based on a criteria.

I have been trying to change it so that if I have strField(1) that is Not Null and another strField(2) that Is Null and strField(1) is a duplicate then delete it.

Any help would be appreciated.

Thanks,

Slen

below is the code i am working with (orginally posted by NeoPa)

Expand|Select|Wrap|Line Numbers

解决方案

Why do it through VBA instead of a delete query?


Mostly because I have code built that is doing a few other things to the table before and after finding the duplicates.

I was trying to avoid the whole dup/append queries and then pull that information back in to the main table.

slen :D


Well, then you pretty much translate what you said into VBA code

Expand|Select|Wrap|Line Numbers


这篇关于使用VBA删除重复项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆