Comparing and copy cells VBA script

Closed
vimol Posts 4 Registration date Friday October 4, 2013 Status Member Last seen October 7, 2013 - Oct 4, 2013 at 09:59 AM
 Blocked Profile - Oct 7, 2013 at 02:43 PM
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 responses

Blocked Profile
Oct 4, 2013 at 10:29 AM
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
0
vimol Posts 4 Registration date Friday October 4, 2013 Status Member Last seen October 7, 2013
Oct 5, 2013 at 05:09 AM
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.
0
Blocked Profile
Oct 5, 2013 at 08:35 AM
Did you understand the nested logic example I gave you?
0
vimol Posts 4 Registration date Friday October 4, 2013 Status Member Last seen October 7, 2013
Oct 5, 2013 at 09:17 AM
Yes I did.
0
vimol Posts 4 Registration date Friday October 4, 2013 Status Member Last seen October 7, 2013
Oct 7, 2013 at 10:00 AM
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?
0
Blocked Profile
Oct 7, 2013 at 02:43 PM
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!
0