vba 如何检查两行是否相同并在行列表中包含相同的数据

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6295807/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 13:24:55  来源:igfitidea点击:

How to check if two rows are identical and contain the same data in a list of rows

excelexcel-vbavba

提问by Satbir

I have a list of lines in the D column and every line has a few properties in columns I, J, K and so on. I want to check my list if any rows contain the same properties and same line number. I want to delete the identical row and all the information in the columns. I'm new to VB so have no idea where to begin. My Sheet is called "Sheet1" and the column begins at D30 and goes to the right up until column AK30. The row begins at 30 and goes down to 7000. If anyone could help me with this it would much appreciated.

我在 D 列中有一个行列表,每行在 I、J、K 等列中都有一些属性。我想检查我的列表是否有任何行包含相同的属性和相同的行号。我想删除相同的行和列中的所有信息。我是 VB 新手,所以不知道从哪里开始。我的工作表被称为“Sheet1”,该列从 D30 开始,向右移动直到 AK30 列。该行从 30 开始,然后下降到 7000。如果有人可以帮助我,我将不胜感激。

Thanks

谢谢

回答by Alen

My idea is use something very similiar to the used in this post:

我的想法是利用一些东西到中使用非常相似 这篇文章

  • Add a new column where you "Concatenate"all the paremeters to be checked in the row.
  • Seleect all your data and "Remove Duplicates"that appear based in the column with concatenated results.
  • 添加一个新列,您可以在其中“连接”行中要检查的所有参数。
  • 选择您的所有数据并根据具有串联结果的列中显示的“删除重复项”

concatenateis a formula to string together the input values, where Remove Duplicatesis self explanatory and is under Datatab in the Data Toolssubtab (in excel 2007).

concatenate是一个将输入值串在一起的公式,其中Remove Duplicates是不言自明的,位于Data Tools子选项卡(在 excel 2007 中)的数据选项卡下。

Regards

问候