You are here:

Excel/Vlook up macro to return pictures


QUESTION: I have a list of part numbers in sheet 1 column A and corresponding photos for each part number in column F. Now I have a list of part numbers in sheet 2 and I want to apply Vlookup funtion in sheet2 and if that part number exist in sheet 2 photo of that part should come in sheet 2 column B. Please help me by telling how can I do this.

ANSWER: VLOOKUP (or any function) returns a VALUE, not a picture
So if it's a macro, something needs to invoke the macro. If it's a button, it'd depend on the location of the active cell or a prompt to select the active cell. All the macro would do is look for the part number and copy the picture from column F. But that seems a little overkill since that process could be done manually (unless you're talking about hundreds of part numbers).
Tell me how you'd like to proceed.

---------- FOLLOW-UP ----------

QUESTION: I want to do it for thousand of pictures

Run this with Sheet2 active:

Sub PutInPix()
On Error Resume Next
Dim n As Integer
   For i = 1 To Range("A60000").End(xlUp).Row
       n = 0
       n = Application.Match(Cells(i, 1).Value, Sheets("Sheet1").Range("A:A"), 0)
       If n > 0 Then
         Sheets("Sheet1").Cells(n, 6).CopyPicture Appearance:=xlScreen, Format:=xlPicture
         Cells(i, 2).Select
       End If
End Sub
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Bob Umlas


I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...) Also check out my in-person training link at


Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Excellence, The Expert, Microsoft

BA in math, Hofstra University, 1965

Awards and Honors
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks

©2016 All rights reserved.