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
 

Fouko

New member
Joined
Feb 8, 2012
Messages
5
Reaction score
0
Points
0
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
 

Ken Puls

Administrator
Staff member
Joined
Mar 13, 2011
Messages
2,519
Reaction score
4
Points
38
Location
Nanaimo, BC, Canada
Website
www.excelguru.ca
Excel Version(s)
Excel Office 365 Insider
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. :)
 
Top