insert image URL images into CELLS

excel_2009

Active Member
Joined
Sep 14, 2009
Messages
318
hi excel gurus,

I was wondering if it would be possible to insert image urls as images into cells in excel? if so how?

thank you
 
Hi Andrew,

Indeed it is :biggrin:

Thank you so much, as I've said before you truly are an asset to the excel community!!!!
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Hi Andrew,

I'm new in VBA and I'm using Office 2011 of MAC. When I used your code


Sub Test()
Dim Rng As Range
Dim Cell As Range
Dim Pic As Picture
Application.ScreenUpdating = False
Set Rng = Range("D2:D" & Range("c" & Rows.Count).End(xlUp).Row)
For Each Cell In Rng
With Cell
Set Pic = .Parent.Pictures.Insert(.Value)
With .Offset(, -1)
Pic.Top = .Top
Pic.Left = .Left
Pic.Height = .Height
Pic.Width = .Width
End With
End With
Next Cell
Application.ScreenUpdating = True
End Sub

It appears highlighted the line:

Set Pic = .Parent.Pictures.Insert(.Value)

Maybe there is another formula for Office 2011?

We have 400 rows and in row C we have the url and we would like to show them on column D. Could you please help me???? One it works, do I have to setup the size of the image and the cell?

Thank you in advance!!!!!
 
Upvote 0
ups sorry, the is a column with many url of a picture. The url works fine and if you copy it to a browser, it shows a picture...

Manually I don't know neither the way to inser it from a url... If I go to insert picture there is no option to copy the url adress...

But as I have more than 400 rows, manually will be not a good solution...
 
Upvote 0
cchhaass, have you found the solution?

I have a column with image-url.
I want to render images instead of this urls in the same cells.

I googled a lot but I can't find any working macros..
 
Upvote 0
Maybe try:

Code:
Sub IMAGE()
    Dim Rng As Range
    Dim Cell As Range
    Dim Pic As Picture
    Application.ScreenUpdating = False
    Columns("J:J").ColumnWidth = 21.29
    Set Rng = Range("K2:K" & Range("k" & Rows.Count).End(xlUp).Row)
    For Each Cell In Rng
        With Cell
            On Error Resume Next
            Set Pic = .Parent.Pictures.Insert(.Value)
            If Err <> 0 Then
                Err.Clear
            Else
                With .Offset(, -1)
                    Pic.Top = .Top
                    Pic.Left = .Left
                    Pic.Height = .Height
                    Pic.Width = .Width
                End With
            End If
            On Error GoTo 0
        End With
    Next Cell
    Rows("2:11").RowHeight = 120
    Application.ScreenUpdating = True
End Sub


Hey Andrew,

This is pretty cool. How would you adjust this so that it would recalculate every time a specific cell changes? Let's say cell Z1 has a dropdown and I want my images to change accordingly only when that cell is hit. Can that be incorporate in the code? And second part of the question, right now when i rerun the code it keeps adding images on top of each other. Can this be adjusted so that 'old' image disappears and only the correct one shows up? So if I hit cell Z1 several times I would have only one image per cell.
Thanks so much.
 
Upvote 0
Yes, of course:

Code:
Sub Test()
    Dim Rng As Range
    Dim Cell As Range
    Dim Pic As Picture
    Application.ScreenUpdating = False
    Set Rng = Range("C1:C" & Range("c" & Rows.Count).End(xlUp).Row)
    For Each Cell In Rng
        With Cell
            Set Pic = .Parent.Pictures.Insert(.Value)
            With .Offset(, -1)
                Pic.Top = .Top
                Pic.Left = .Left
                Pic.Height = .Height
                Pic.Width = .Width
            End With
        End With
    Next Cell
    Application.ScreenUpdating = True
End Sub


Hi Andrew,

This works fantastically, thank you.

Is it possible to embed the images in excel rather than having them linked so that they could be viewed when working offline?

please see my current code Below:

Sub IMAGE()
Dim Rng As Range
Dim Cell As Range
Dim Pic As Picture
Application.ScreenUpdating = False

Set Rng = Range("C3:C" & Range("c" & Rows.Count).End(xlUp).Row)
For Each Cell In Rng
With Cell
On Error Resume Next
Set Pic = .Parent.Pictures.Insert(.Value)
If Err <> 0 Then
Err.Clear
Else
With .Offset(, 1)
Pic.Top = .Top + 5
Pic.Left = .Left + 5
Pic.Height = 10
Pic.Width = 65
End With
End If
On Error GoTo 0
End With
Next Cell
Rows("3:203").RowHeight = 75
Application.ScreenUpdating = True
End Sub

Regards
 
Upvote 0

Forum statistics

Threads
1,224,876
Messages
6,181,522
Members
453,050
Latest member
Obil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top