Created
April 26, 2021 06:14
-
-
Save imamuddinwp/f8ee2774128731229d923e2fcf421f5f to your computer and use it in GitHub Desktop.
Get Image to cell in excel from URL; Convert image URL to actual image in excel; Powered by Imam Uddin; imamuddinwp.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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"