Retrive Value to empty cell
Solved/Closed3 responses
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
May 3, 2012 at 09:41 AM
May 3, 2012 at 09:41 AM
Hi Ornitor,
If it's possible to move (or copy) Sheet1 ColumnA to Sheet1 ColumnE you could use VLOOKUP:
Sheet2 Cell C2: =VLOOKUP(B2,Sheet1!D$2:E$10,2)
If ColumnE is already used, you can use another column as long as it's to the right of ColumnD.
Best regards,
Trowa
If it's possible to move (or copy) Sheet1 ColumnA to Sheet1 ColumnE you could use VLOOKUP:
Sheet2 Cell C2: =VLOOKUP(B2,Sheet1!D$2:E$10,2)
If ColumnE is already used, you can use another column as long as it's to the right of ColumnD.
Best regards,
Trowa
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
May 3, 2012 at 10:15 AM
May 3, 2012 at 10:15 AM
Since I had some spare time, here is a code you might like:
Best regards,
Trowa
Sub RetrieveValue() Dim lRow, lRow2, x As Integer lRow = Sheets("Sheet2").Range("B" & Rows.Count).End(xlUp).Row lRow2 = Sheets("Sheet1").Range("D" & Rows.Count).End(xlUp).Row For Each cell In Sheets("Sheet2").Range("B2:B" & lRow) x = 1 Do Until x = lRow2 x = x + 1 If cell.Value = Sheets("Sheet1").Range("D" & x) Then _ cell.Offset(0, 1).Value = Sheets("Sheet1").Range("A" & x).Value Loop Next cell End Sub
Best regards,
Trowa