如何使用vba从Excel中的2列中删除重复值
我是 Excel VBA 编程新手。我有一个包含两列的 Excel 工作表,每列都有一些用 @@ 分隔的电子邮件地址。喜欢
A栏
[电子邮件受保护]@@[电子邮件受保护]@@[电子邮件;受保护]
[电子邮件受保护]@@[电子邮件受保护]
ColumnB
[电子邮件受保护]@@[电子邮件受保护]
[email protected]
如您所见,两列都有两个行,我需要第三列,其中应包含所有唯一值,例如
C栏
[电子邮件受保护]@@[电子邮件受保护]@@[电子邮件受保护]@[电子邮件受保护]
[电子邮件受保护]@@[电子邮件受保护]@@[电子邮件;受保护]
谢谢
I am new to Excel VBA Programming. I have one excel sheet with two columns and each column has some email adresses separated by @@. like
ColumA
[email protected]@@[email protected]@@[email protected]
[email protected]@@[email protected]
ColumnB
[email protected]@@[email protected]
[email protected]
As you can see that both column has two rows, I need 3rd column that should contain all the unique values like
ColumnC
[email protected]@@[email protected]@@[email protected]@[email protected]
[email protected]@@[email protected]@@[email protected]
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
像这样的变体数组和字典是获得所需结果的有效过程
[更新以删除字符串前面的分隔符,代码在分隔符长度上是灵活的]
所以似乎已经删除了上传图像的功能,所以我的照片已经脱落了....
Something like this with variant arrays and a dictionary is an efficient process of getting your desired outcome
[updated to remove delimiter at front of string, code is flexible on delimiter length]
SO seems to have removed the ability to upload image so my picture has fallen off ....
这是我的看法。工作原理:
注意:
它与 brettdj 的答案非常相似,但有一些差异值得一提:
Here's my take. How it works:
Note:
It's fairly similar to brettdj's answer, but there are a few differences worth mentioning:
最简单的方法是使用 字典对象,拆分函数,以及加入函数< /a>.当然,您不需要使用那些确切的,但尝试一下,看看您会得到什么。
The easiest way to do this would be to use the dictionary object, split function, and join function. Of course, you don't need to use those exact ones, but give it a try and see what you get.