Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get Image to cell in excel from URL; Convert image URL to actual image in excel; Powered by Imam Uddin; imamuddinwp.
Sub Excel_Download_Image_From_URL()
'Proudly Powered by Imam Uddin
'https://gist.github.com/imamuddinwp
Dim Pshp As Shape
Dim xRg As Range
Dim xCol As Long
On Error Resume Next
Application.ScreenUpdating = False
'Set rng = ActiveSheet.Range("A2:A140")
Set rng = ActiveSheet.Range("A3", ActiveSheet.Range("A3").End(xlDown))
For Each cell In rng
filenam = cell
ActiveSheet.Pictures.Insert(filenam).Select
Set Pshp = Selection.ShapeRange.Item(1)
Pshp.Placement = xlMoveAndSize
If Pshp Is Nothing Then GoTo lab
xCol = cell.Column + 1
Set xRg = Cells(cell.Row, xCol)
With Pshp
.LockAspectRatio = msoFalse
.Width = 120
.Height = 60
.Top = xRg.Top + (xRg.Height - .Height) / 2
.Left = xRg.Left + (xRg.Width - .Width) / 2
End With
lab:
Set Pshp = Nothing
Range("A2").Select
Next
Application.ScreenUpdating = True
End Sub
@imamuddinwp
Copy link
Author

imamuddinwp commented Apr 26, 2021

Tags:
"Keyword"
"excel vba download image from url"
"download images from url list excel"
"how to hyperlink image in excel"
"excel hyperlink image formula"
"excel vba get image from website"
"excel vba insert image from url"
"access vba download image from url"
"excel image function"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment