importing thousands of .jpg images to excel

A

Andrea

I have an excel spreadsheet with all the data I need except the images. The
images are in another location saved in my computer (about 15,000). The SKU
#s are in column A on the spreadsheet. The images are all named with the
same SKU #s. How do I import the images into the spreadsheet so they match
up correctly?
 
G

Gary''s Student

This example assumes that the names are in column A, example, andrea
The filename would be andrea.jpg and the files are located in C:\test

Sub Macro1()
Dim n As Long
Dim v As String
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To n
v = "C:\test\" & Cells(i, 1).Value & ".jpg"
ActiveSheet.Pictures.Insert (v)
Next
End Sub
 
A

Andrea

Thanks! Is there an easier way to explain this? I am only familiar with
excel basics and this pretty much lost me. Where do I place this formula?
 
G

Gord Dibben

It is not a formula, it is a VBA macro

If you're not familiar with VBA and macros, see David McRitchie's site for
more on "getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

or Ron de De Bruin's site on where to store macros.

http://www.rondebruin.nl/code.htm

In the meantime..........

First...create a backup copy of your original workbook.

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + r to open Project Explorer.

Find your workbook/project and select it.

Right-click and Insert>Module. Paste the code in there. Save the
workbook and hit ALT + Q to return to your workbook.

Run or edit the macro by going to Tool>Macro>Macros.

You can also assign this macro to a button or a shortcut key combo.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top