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?
Reason 2: Objects are hidden Click “For objects, show all” within the Excel options. Within the Excel settings you can choose if objects (including charts and images) should be shown in your workbook. If this setting is set to hide all objects, you cannot insert any new objects so that the buttons are greyed-out.
Click the location in your worksheet where you want to insert a picture. On the Insert ribbon, click Pictures. Select Stock Images… Browse to the picture you want to insert, select it, and then click Open.
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...
There is some faster way (https://www.youtube.com/watch?v=TSjEMLBAYVc):
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.
Now we can add a picture to Excel directly and easely. Just follow these instructions:
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With