VBA to COPY cell with conditions

Fouko

New member
Joined
Feb 8, 2012
Messages
5
Reaction score
0
Points
0
Hi everyone,

I have "Sheet1" and "Sheet2"

In need to add a VBA for conditional cell copy like this :
IF Sheet1 (Cell"A23") = Sheet2 (a cell in Column"A") THEN copy the "Sheet2" same line cell from column B TO Sheet1("B2")

To be clear :
IF Sheet1 (Cell"A23") = Text_To_Find
SEARCH in Sheet2 (a cell in Column"A") = Text_To_Find (ex: A12)
THEN Copy B12 TO Sheet1 (Cell"B2")

Hope my explanations are clear.
Thanks a lot
Fouko
 
Yeah, I have found the trick with no VBA:

In the Sheet1 (Cell"B2") I put this :
Code:
=VLOOKUP([COLOR=#b22222]B2[/COLOR];[COLOR=#006400]Sheet2![/COLOR][COLOR=#006400]A1:B50[/COLOR];2;FALSE)

And it's works !!

Fouko
 
Sorry that I didn't get here sooner to answer, but I'm glad you worked out a solution. Almost always better to go the formula route instead of VBA if possible. :)
 
Back
Top