Hi All,
Here is a UDF, which helps to insert a picture into a cell.
Enjoy !!
Code:
Function INSERTPICTURE(ByVal PictureFullName As String, Optional ByVal PicWidth As Single = 200, _
Optional ByVal PicHeight As Single = 150)
'// Author : Kris @ ExcelFox.com
Dim CellActive As Range
Dim picPicture As Object
Set CellActive = Application.Caller
For Each picPicture In CellActive.Parent.Pictures
If picPicture.TopLeftCell.Address = CellActive.Address Then
picPicture.Delete
Exit For
End If
Next
Set picPicture = CellActive.Parent.Pictures.Insert(PictureFullName)
With picPicture
.Left = CellActive.Left + 1
.Top = CellActive.Top + 1
.Width = PicWidth
.Height = PicHeight
End With
End Function
use like =INSERTPICTURE("C:\Pictures\MyPicture.jpg")
PFA sample workbook.
Bookmarks