Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've Two sheets, Sheet1, Sheet2

Sheet1:

A   | B
-----
123 |
456 |
789 | 

Sheet 2:

A   | B
-----
123 | DATA1
789 | DATA2
456 | DATA3

I want The Sheet1 to have the following output:

A   | B
-----
123 | DATA1
456 | DATA3
789 | DATA2

I have a very basic VB knowledge, how can I accomplish this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
225 views
Welcome To Ask or Share your Answers For Others

1 Answer

Sheet1, cell B1: =VLOOKUP(A1,Sheet2!$A$1:$B$3,2,0) and drag down should give the desired result

Edit (VBA solution): Sheet1.Range("B1:B3").Formula = "=VLOOKUP(A1,Sheet2!$A$1:$B$3,2,0)"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...