139

I'm tying to generate a report with pictures, but I cannot get the pictures into a single cell. I can get the pictures to "float" around my worksheet, but I need to put them into a cell. How can I do this?

bubbleking
  • 2,655
  • 3
  • 21
  • 41
Reid
  • 3,989
  • 8
  • 35
  • 64
  • how many pictures do u need in a single cell? – Teja Mar 19 '12 at 19:31
  • I need one picture per cell, and I have just tried the insert image, and special paste. – Reid Mar 19 '12 at 19:36
  • 5
    You cannot put pictures "in" a cell, only "over" it. All pictures "float" on the worksheet. You can position a picture over a cell by setting its `Top` and `Left` properties to the `Top` and `Left` of the cell. If you edit your question with the code you're using, it will be easier to suggest an approach which might work for you. – Tim Williams Mar 19 '12 at 19:52
  • In addition to what @TimWilliams suggested, you can also resize the cell to match the image if needed (and doesn't change your sheet formatting too horribly) – Gaffi Mar 19 '12 at 20:08
  • Thank you for your help. No wonder why I had so many problems, it is not possible to do what I wanted. I have just done my report by hand, and by eye. – Reid Mar 19 '12 at 20:40
  • 3
    See [this walkthough](http://www.ehow.co.uk/how_5452020_insert-picture-excel-cell.html) for both the "over cell" and "comment" methods. – Nigel Touch Jan 11 '13 at 19:55
  • Microsoft, if you're listening... please make sure that a re-size of a row or column respects the size of the image!!! Very important! – MacGyver Feb 21 '13 at 17:58
  • Faced with a similar problem, I decided to build the report in a Microsoft Word table. Here you just paste the image into the table cell. – OutstandingBill Jun 28 '16 at 16:45

6 Answers6

109

You can add the image into a comment.

Right-click cell > Insert Comment > right-click on shaded (grey area) on outside of comment box > Format Comment > Colors and Lines > Fill > Color > Fill Effects > Picture > (Browse to picture) > Click OK

Image will appear on hover over.

Microsoft Office 365 (2019) introduced new things called comments and renamed the old comments as "notes". Therefore in the steps above do New Note instead of Insert Comment. All other steps remain the same and the functionality still exists.


There is also a $20 product for Windows - Excel Image Assistant...

MD004
  • 496
  • 1
  • 6
  • 18
Amber
  • 1,130
  • 1
  • 9
  • 3
  • Will this be automated, in the sense that the included picture on the cell can be reference/grabbed via a formula? – Andy Hayden Oct 03 '12 at 22:04
  • 12
    Too bad it does not work with clipboard images. – Mauricio Quintana Jan 20 '14 at 22:22
  • 12
    **Note**. It is important to right-click on the border not inside the comment box since the Format Comment dialog window will have different options in each case. – Developer Marius Žilėnas Jan 19 '15 at 12:29
  • 2
    I didn't find this satisfactory because when I hovered I could see that Excel resized my image, thereby distorting it and making it useless – wytten Oct 21 '15 at 13:45
  • 2
    @wytten there is an option to lock the aspect ratio (and therefore not distorting it). That said I also find it poor that the picture is in a comment box, not in a cell. – Daniel Sparing Jan 20 '16 at 08:26
  • @DanielSparing The fixed aspect ratio option seems to broken for me. It has a minimum width and cuts of the image inappropriately in the middle of the height. – Lime Mar 01 '16 at 19:47
  • 4
    Seems not working on mac. No matter what I do, I don't see that "Colors and Lines" option. – Andy Song Jun 29 '16 at 03:58
  • well, this is working very good option for windows but I used to paste a full image into cell area and link the main cell to full image cell! this will help me to view complete image by single click :) – dipan chikani Jan 03 '18 at 10:09
53

There is some faster way (https://www.youtube.com/watch?v=TSjEMLBAYVc):

  1. Insert image (Ctrl+V) to the excel.
  2. Validate "Picture Tools -> Align -> Snap To Grid" is checked
  3. Resize the image to fit the cell (or number of cells)
  4. Right-click on the image and check "Size and Properties... -> Properties -> Move and size with cells"
vr286
  • 767
  • 6
  • 3
  • 1
    Step 2 is not needed – cup Apr 02 '16 at 05:40
  • 5
    This doesn't answer the question directly. But, it's what I was looking for and arguably the solution most people really want. – Robert Lugg Nov 02 '16 at 19:35
  • 1
    This solution would be best when viewing the spreadsheet or printing, the popular answer above would be great when viewing the spreadsheet on a computer and only seeing the images when the user wants to. – Rick Henderson Jan 25 '17 at 19:22
16

just go to google docs and paste this as a formula, where URL is a link to your img

      =image("URL", 1)

afterwards, from google docs options, download for excel and you'll have your image on the cell EDIT Per comments, you dont need to keep the image URL alive that long, just long enough for the excel to download it. Then it will stay embedded on the file.

virgula24
  • 523
  • 5
  • 21
  • 1
    You need to host image somewhere for this solution. Even Google Drive won't work for this case. – hris.to Jan 19 '15 at 19:36
  • guys you dont need to keep the url alive after you download the excel file from google docs, it will embed the picture on excel itself – virgula24 Jan 21 '15 at 05:20
  • 2
    @virgula24, thanks for sharing the tip. After I download the google sheet as a excel file, the image does not appear in the cell. The cell's value is still =image("URL", 1), which cant be interrepted by Microsoft Excel. If I donwload as a PDF, the image is displayed as expected. – Frank Liu Aug 31 '15 at 23:58
  • Just tried, still works. Google added additional options, so you can use my sugestion or =image("URL", mode, height,width) – virgula24 Jan 18 '17 at 14:41
8

Now we can add a picture to Excel directly and easely. Just follow these instructions:

  1. Go to the Insert tab.
  2. Click on the Pictures option (it’s in the illustrations group). image1
  3. In the ‘Insert Picture’ dialog box, locate the pictures that you want to insert into a cell in Excel. image2
  4. Click on the Insert button. image3
  5. Re-size the picture/image so that it can fit perfectly within the cell. image4
  6. Place the picture in the cell. A cool way to do this is to first press the ALT key and then move the picture with the mouse. It will snap and arrange itself with the border of the cell as soon it comes close to it.

If you have multiple images, you can select and insert all the images at once (as shown in step 4).

You can also resize images by selecting it and dragging the edges. In the case of logos or product images, you may want to keep the aspect ratio of the image intact. To keep the aspect ratio intact, use the corners of an image to resize it.


When you place an image within a cell using the steps above, it will not stick with the cell in case you resize, filter, or hide the cells. If you want the image to stick to the cell, you need to lock the image to the cell it’s placed n.

To do this, you need to follow the additional steps as shown below.

  1. Right-click on the picture and select Format Picture. image5
  2. In the Format Picture pane, select Size & Properties and with the options in Properties, select ‘Move and size with cells’. image6

Now you can move cells, filter it, or hide it, and the picture will also move/filter/hide.


NOTE:

This answer was taken from this link: Insert Picture into a Cell in Excel.

ziMtyth
  • 824
  • 11
  • 28
2

While my recommendation is to take advantage of the automation available from Doality.com specifically Picture Manager for Excel

The following vba code should meet your criteria. Good Luck!

Add a Button Control to your Excel Workbook and then double click on the button in order to get to the VBA Code -->

Sub Button1_Click()
    Dim filePathCell As Range
    Dim imageLocationCell As Range
    Dim filePath As String

    Set filePathCell = Application.InputBox(Prompt:= _
        "Please select the cell that contains the reference path to your image file", _
            Title:="Specify File Path", Type:=8)

     Set imageLocationCell = Application.InputBox(Prompt:= _
        "Please select the cell where you would like your image to be inserted.", _
            Title:="Image Cell", Type:=8)

    If filePathCell Is Nothing Then
       MsgBox ("Please make a selection for file path")
       Exit Sub
    Else
      If filePathCell.Cells.Count > 1 Then
        MsgBox ("Please select only a single cell that contains the file location")
        Exit Sub
      Else
        filePath = Cells(filePathCell.Row, filePathCell.Column).Value
      End If
    End If

    If imageLocationCell Is Nothing Then
       MsgBox ("Please make a selection for image location")
       Exit Sub
    Else
      If imageLocationCell.Cells.Count > 1 Then
        MsgBox ("Please select only a single cell where you want the image to be populated")
        Exit Sub
      Else
        InsertPic filePath, imageLocationCell
        Exit Sub
      End If
    End If
End Sub

Then create your Insert Method as follows:

Private Sub InsertPic(filePath As String, ByVal insertCell As Range)
    Dim xlShapes As Shapes
    Dim xlPic As Shape
    Dim xlWorksheet As Worksheet

    If IsEmpty(filePath) Or Len(Dir(filePath)) = 0 Then
        MsgBox ("File Path invalid")
        Exit Sub
    End If

    Set xlWorksheet = ActiveSheet

    Set xlPic = xlWorksheet.Shapes.AddPicture(filePath, msoFalse, msoCTrue, insertCell.top, insertCell.left, insertCell.width, insertCell.height)
    xlPic.LockAspectRatio = msoCTrue
End Sub
Daniel
  • 164
  • 5
  • very interesting solution but I can't implement it. Where/how do I create the insert method? – Herman Toothrot Oct 01 '15 at 15:49
  • I think "Set xlPic" line should read like this: Set xlPic = xlWorksheet.Shapes.AddPicture(filePath, msoFalse, msoCTrue, **insertCell.left, insertCell.top**, insertCell.width, insertCell.height) as per https://msdn.microsoft.com/en-us/library/office/ff198302.aspx – mprost Oct 03 '15 at 09:03
  • After implementing the code for the click event on the button you can simply go below EndSub to begin a new Sub routine. I must caution though that opening up Excel to utilize Vba code requires any Excel that runs your code to lower its security settings. Recent attacks on companies intellectual properties have taken advantage of this specific gap in security which is why I would advise against a broad Macro implementation and bite the bullet and pay the $35 for the aforementioned add-in with a provided UI and without opening your file up to potential risk. – Daniel Oct 12 '16 at 19:29
-2

You can do it in a less than a minute with Google Drive (and free, no hassles)

• Bulk Upload all your images on imgur.com

• Copy the Links of all the images together, appended with .jpg. Only imgur lets you do copy all the image links together, do that using the image tab top right.

• Use http://TextMechanic.co to prepend and append each line with this: Prefix : =image(" AND Suffix : ", 1)

So that it looks like this =image("URL", 1)

• Copy All

• Paste it in Google Spreadsheet

• Voila!

References :

http://www.labnol.org/internet/images-in-google-spreadsheet/18167/

https://support.google.com/drive/bin/answer.py?hl=en&answer=87037&from=1068225&rd=1

Display name
  • 9,021
  • 3
  • 29
  • 59
anshumanc
  • 57
  • 1