Results 1 to 10 of 11

Thread: Insert Picture in a Cell UDF

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10

    Lightbulb Insert Picture in a Cell UDF

    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.
    Attached Files Attached Files
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

Similar Threads

  1. Question on UDF LookUpConcat
    By K2` in forum Excel Help
    Replies: 4
    Last Post: 05-07-2013, 10:25 PM
  2. Trouble implementing UDF's
    By ProspectiveCounselor in forum Excel Help
    Replies: 4
    Last Post: 05-06-2013, 08:07 PM
  3. Automatically Insert Row
    By marreco in forum Excel Help
    Replies: 7
    Last Post: 12-21-2012, 06:43 PM
  4. Replies: 4
    Last Post: 05-03-2012, 10:28 AM
  5. UDF to Create In-Cell Chart in Excel
    By Admin in forum Download Center
    Replies: 0
    Last Post: 08-13-2011, 09:53 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •