Excel:查找值并进行比较的VBA代码 [英] Excel: VBA code that look for values and compare it

查看:146
本文介绍了Excel:查找值并进行比较的VBA代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我需要一些VBA代码的帮助。我尝试过在论坛上资助的不同代码但是它们与我想要的东西不匹配。所以我将解释我拥有什么,我需要什么以及我期待什么。


我有一张2张工作簿(Sheet1,Sheet2)。两张纸的值都在A到F列中(A:F)。值从A2开始。两张表中的B2 ......等等,最终有时达到A1000。 B1000。 ...等等


我想做什么:

我需要一个宏来查找工作表1中的值而不是工作表2中的值。

并且宏也将在Sheet1中查找Sheet2和NOY中的值。


我需要什么:

结果是否出现在新工作簿(或Sheet3)中,结果显示在列A和B中。在列Ait中,将显示Sheet1中的值和Sheet2中的NOT。在B列中,Sheet2中的值和Sheet 1中的NOT。


因此,如果有人可以帮助我,那将是很好的,因为我真的不知道如何做到这一点。 br />

谢谢


如果有人有不同的想法显示你的建议开放的结果。

解决方案

下面是比较Range中Sheet1中每个值的基本逻辑


A


2:

Hi all,

I need some help with a VBA code. I have tried differents codes that i fund in the forum but they didn t match with what i m looking for. So i will explain what i have , what i need and what i expect.

I have a workbook with 2 sheets (Sheet1 , Sheet2). Both sheets have values in columns A to F. (A:F). Values Start at A2. B2..... etc in both sheets, and end up sometimes at A1000. B1000. ... etc.

What i want to do:
I need a macro that look for the values that are in Sheet 1 and NOT in Sheet 2.
And also the macro will look for the values that are in Sheet2 and NOY in Sheet1.

What i need:
Is that the result appears in a new workbook ( or in Sheet3), and that the result appears in columns A and B. In column Ait will display the values that are in Sheet1 and NOT in Sheet2. And in Column B the values that are in Sheet2 and NOT in Sheet 1.

So if anyone can help me it would be great because i really don t know how to do this.

Thanks

if anyone has a different idea of displaying results i m open to your advices.

解决方案

Here is the basic Logic that you would need to compare every Value in Sheet1 within the Range


A


2:


这篇关于Excel:查找值并进行比较的VBA代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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