Windy Skies
New Member
- Joined
- Dec 27, 2012
- Messages
- 47
Hi,
Say I have an image in cell A1, how would I display that image in a different cell using a formula? I would like to do this to more easily (or at all) use the images in an =vlookup formula.
Background:
I've added thousands of pictures into an excel file using this macro I've found on the internet. The Excel file is still only 200kb so they must be linked somehow. The images do not have useful file names, so I will have to add useful sorting information manually:
Say I have an image in cell A1, how would I display that image in a different cell using a formula? I would like to do this to more easily (or at all) use the images in an =vlookup formula.
Background:
I've added thousands of pictures into an excel file using this macro I've found on the internet. The Excel file is still only 200kb so they must be linked somehow. The images do not have useful file names, so I will have to add useful sorting information manually:
Code:
Sub InsertPictures()
Dim Pict() As Variant
Dim ImgFileFormat As String
Dim PictCell As Range
Dim lLoop As Long
Dim sShape As Picture
ActiveSheet.Protect False, False, False, False, False
ImgFileFormat = "All Picture Files(*.emf;*.wmf;*.jpg;*.jpeg;*.jfif;*.jpe;*.png;*.bpm;*.gif;*.gfa;*.emz;*.wmz;*.pcz;*.tif;*.tiff;*.cgm;*.eps;*.pct;*.pict;*.wpg;*.pcd;*.pcx;*.cdr;*.fpx;*.mix), *.bmp"
'Note you can load in any nearly file format
Pict = Application.GetOpenFilename(ImgFileFormat, MultiSelect:=True)
If Not IsArray(Pict) Then
Debug.Print "No files selected."
Exit Sub
End If
Set PictCell = Selection.Cells(1)
For lLoop = LBound(Pict) To UBound(Pict)
Set sShape = ActiveSheet.Pictures.Insert(Pict(lLoop))
With sShape
If .Height < 408.75 Then
PictCell.EntireRow.RowHeight = .Height
End If
' If .Width < 254 Then
' PictCell.EntireColumn.ColumnWidth = .Width
' End If
.Top = PictCell.Top
.Left = PictCell.Left
End With
Set PictCell = PictCell.Offset(1)
Next lLoop
End Sub