Comparing and copy cells VBA script [Closed]

Report
Posts
4
Registration date
Friday October 4, 2013
Status
Member
Last seen
October 7, 2013
-
 Blocked Profile -
Hallo, I need some VBA script to compare two cells like ex: A2 with B2, A3 with B3 and if B2 or B3 is empty should A2 or A3 be copied to Sheet2( or in another column). But if its something in cells B2 or B3 should the information from Sheet2 be deleted. Is it possible? I really hope you can read my weird English...

2 replies


Good Morning.

The logic for If statements in excel is as follows:
=if(logic test, true, false)

So, with that in mind, if your data starts with:
A1 B1
"apple" "apple"

In cell C1, you could have the formula of:
=if(A1=B1,"There are both apples","they do not match")

Now, that we have the first logic statement, we can nest other logical tests in the first If statement for:

=If(A1=B1,IF(someothervalue=sometest,"the first test was true, and so was the scond test","the first test was true, but the second test is false"),"Failed the first test because they do not match")

Let me know if that gets you further. We will tackle to second part of your solution after you understand the logic tests.

I understand you are looking for VBA code, this is in formula bar n the sheet itself, and does not require a module.

Please post back.

//ark
-Contributor
Posts
4
Registration date
Friday October 4, 2013
Status
Member
Last seen
October 7, 2013

Thank you for answer!

But what I need is: In A1 is XYZ in B1 is nothing so take the information XYZ and copy to Sheet2(or another column). If in B1 is something written (mustn't match with A1!) do nothing.
Blocked Profile
Did you understand the nested logic example I gave you?
Posts
4
Registration date
Friday October 4, 2013
Status
Member
Last seen
October 7, 2013

Yes I did.
Posts
4
Registration date
Friday October 4, 2013
Status
Member
Last seen
October 7, 2013

Thank you but I don't see how this script can resolve my problem. I don't see there any comparing betwen cells or something. I don't see there even one time If mentioned... Maybe I'm stupid can you please explain me how can I use that?
Blocked Profile
My point was to combine the two, and let us know what you need help with. I am not here to PRODUCE A COMPLETE PRODUCT for YOU, I am here to provide you with help along the way.

I would love to be able to ask the forum to produce my RANGED WEAPON COLLIDER for me. But I might ask how would I go about tracking who collided with what, because I was stuck ON THAT portion.

The reason that you do not see an IF statement in the second link, is because IT WAS ASSUMED that you understood the IF THEN portion of your solution.

I will assist in certain logic hang ups, and methods and such, I will even go as far a wireframe a solution for you. I wil not wrieframe it, write the logic, and author the soltuion, What part are you going to do? What would you learn from that? Is this for work or school? If it is for school, then I am OUT!

Pleae post back with what you have come up with, and I , like most others here, will be happy to help.
Have a great day, and Have fun. Please post back!

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!