View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Ron Coderre Ron Coderre is offline
external usenet poster
 
Posts: 2,118
Default VLOOKUP For Pictures?

You're very welcome.....I'm glad I could help.

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)

"dlanier" wrote in message
...
Thank you so much. This was a lot of help. I actually had to get my IT
guy
to set this up, but he was able to use this to create what I needed.
Thanks
for the fast response.

"Ron Coderre" wrote:

The below code
. loops through each cell in the selected range
. reads the filepath from that cell
. inserts the referenced picture in the cell to the right of the cell:
. resizes the height and width of the picture to the cell's height

Sub InsertPicFromFile()
Dim cCell As Range

For Each cCell In Selection
If cCell.Value < "" Then
On Error Resume Next
ActiveSheet.Shapes.AddPicture _
Filename:=cCell.Value, LinkToFile:=msoFalse,
SaveWithDocument:=msoTrue, _
Left:=cCell.Offset(ColumnOffset:=1).Left, Top:=cCell.Top,
Width:=cCell.Height, Height:=cCell.Height
End If
Next cCell
End Sub


To use that code:
1)Select a vertical range of cells containing complete paths to picture
files.
(Make sure the row heights are large enough to view the pictures.)

2)[Alt]+[F8].....shortcut for <tools<macro<macros....Select:
InsertPicFromFile....Click [Run]

Is that something you can work with?

--------------------------

Regards,

Ron (XL2003, Win XP)
Microsoft MVP (Excel)