Convert image url to actual image in excel

Copper Contributor

I have a column of image URLs in my workbook and would like to show the actual image in the next column. Is there a formula or add in that can be used?

32 Replies

@Haytham Amairah it's not that important any more, but here it is...

Hi @Haytham Amairah ,

 

Thanks for sharing the code. Works, however:

  1. the images do not get inserted within (inside) the cell; they are floating on top of the cells and can be moved around freely; the cells behind the image can be clicked and text entered. Is there a way that the image is inside the cell and can be picked up as data associated with that row?
  2. Can a hyperlink be added such that the image/thumbnail can be clicked and it pops open the original image?
    1.PNG2.PNG3.PNG

Thanks!

 

Mus

@mustansirg1g

 

Hi Mus,

 

Pictures inserted in Excel float in something called (Drawing layer) on top of the worksheet.

It's cannot be added inside the cells.

 

Regards

 

 

Hi,

 

i´ve tried your sample on excel for mac and nothing happend!

 

is it possible that these script won´t work on mac?

 

thank you

markus

Hi @Haytham Amairah 

 

The code works for some URL and not for other. Sometimes i need to click and open the URL so it could "read" and output the image on excel. 

 

Could you please help me with this problem?

This really made my day @Haytham Amairah! :) I was wondering if it's possible to add something to the VBA to append the url to the image as well? So the result is a image that you can click to view the original in browser?

hello is there an option with IF parametres to lock aspect ratio based on whether the height/width of the picture is bigger and then it automatically making it that aspect ratio. for example if the image is landscape oriented it locking the height?

@Haytham Amairah 

 

Hi,

I have the same problem and I got help from your awesome solution, but the last problem is that I need the original size of the pictures. How can I have the Original size of them?

Best

@Haytham Amairah 

 

Thanks it's Working

I know this is an older thread, but does anyone know how to change this VBA to populate the pictures in the cell below instead of to the right? 

HI All
bellow code I'm using but not getting the actual result from goto lab line move in end

Sub URLPictureInsert()
'Updateby Extendoffice 20161116
'Update by Haytham 20180104

Dim Pshp As Shape
Dim xRg As Range
Dim xCol As Long
On Error Resume Next
Application.ScreenUpdating = False
Set Rng = ActiveSheet.Range("d2:d140")
For Each cell In Rng
filenam = cell
ActiveSheet.Pictures.Insert(filenam).Select
Set Pshp = Selection.ShapeRange.Item(1)
If Pshp Is Nothing Then GoTo lab
xCol = cell.Column + 1
Set xRg = Cells(cell.Row, xCol)
With Pshp
.LockAspectRatio = msoFalse
.Width = 60
.Height = 30
.Top = xRg.Top + (xRg.Height - .Height) / 2
.Left = xRg.Left + (xRg.Width - .Width) / 2
End With
lab:
Set Pshp = Nothing
Range("d2").Select
Next
Application.ScreenUpdating = True
End Sub

Hi Haytham,

Is there a easy way to do this for a row instead of a column?

ie. a range of image URLs from B2 to M2 and to show the image beneath it at C2 to M2?

I'm not too familiar with VBA but couldn't get the VBA to work when I changed the columns to rows and rows to columns in the code.

Thank you,
Michael

@MSDON25  Don't know if this might help, but I found a video online that just used the 'image' function. And it worked just fine, if you are not too fuzzy on the dimensions of the image. I just made the rows a bit bigger so the logos show reasonably normal.