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
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
What did you try exactly?

Hi Andrew,

This is what I have so far. It works if I set rng as a single cell but I cant get it to continue down to the next cell.

Sub IMAGE()
Dim Rng As Range
Dim Cell As Range
Dim ws As Worksheet
Dim s As Shape
Set ws = ActiveSheet
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 s = ws.Shapes.AddPicture(Rng, False, True, 280, 10, 70, 70)
If Err <> 0 Then
Err.Clear
Else
End If
On Error GoTo 0
End With
Next Cell
Rows("3:203").RowHeight = 75
Application.ScreenUpdating = True
End Sub

Thanks again
 
Upvote 0
Does this work for you?

Rich (BB code):
Set s = ws.Shapes.AddPicture(Cell.Value, False, True, Cell.Offset(, -1).Left, Cell.Offset(, -1).Top, Cell.Offset(, -1).Width, Cell.Offset(, -1).Height)
 
Upvote 0
Does this work for you?

Rich (BB code):
Set s = ws.Shapes.AddPicture(Cell.Value, False, True, Cell.Offset(, -1).Left, Cell.Offset(, -1).Top, Cell.Offset(, -1).Width, Cell.Offset(, -1).Height)


Hi Andrew,

That works perfectly! Thanks you very much.

final code for anyone else who needs it.

Rich (BB code):
Sub IMAGE()
    Dim Rng As Range
    Dim Cell As Range
    Dim ws As Worksheet
    Dim s As Shape
    Set ws = ActiveSheet
    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 s = ws.Shapes.AddPicture(Cell.Value, False, True, Cell.Offset(, 1).Left, Cell.Offset(, 1).Top, Cell.Offset(, 1).Height, Cell.Offset(, 1).Width)
            
            If Err <> 0 Then
                Err.Clear
            Else
            With .Offset(, 1)
                    s.Top = .Top + 5
                    s.Left = .Left + 5
                    s.Height = 65
                    s.Width = 67
                    End With
            End If
            On Error GoTo 0
        End With
    Next Cell
   
    Rows("3:203").RowHeight = 75
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Hi Andrew,

That works perfectly! Thanks you very much.

final code for anyone else who needs it.

Code:
Sub IMAGE()
    Dim Rng As Range
    Dim Cell As Range
    Dim ws As Worksheet
    Dim s As Shape
    Set ws = ActiveSheet
    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 s = ws.Shapes.AddPicture(Cell.Value, False, True, Cell.Offset(, 1).Left, Cell.Offset(, 1).Top, Cell.Offset(, 1).Height, Cell.Offset(, 1).Width)
            
            If Err <> 0 Then
                Err.Clear
            Else
            With .Offset(, 1)
                    s.Top = .Top + 5
                    s.Left = .Left + 5
                    s.Height = 65
                    s.Width = 67
                    End With
            End If
            On Error GoTo 0
        End With
    Next Cell
   
    Rows("3:203").RowHeight = 75
    Application.ScreenUpdating = True
End Sub

This code is working great for me.. One question tho.

Is it possible to make it so that the column is dynamic? Perhaps looking for a match on the header name? I'm asking because users will be able to pull reports any way they want, so the URL column will be different depending on how it's pulled.
 
Upvote 0

Forum statistics

Threads
1,224,876
Messages
6,181,523
Members
453,051
Latest member
alexbarker2608

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