Convert image url to image – Excel

Add add a new macro called URLPictureInsert and inter the following code. This will take the url from the cell and position the image in the following cell next to it. Ensure the cell is larger than the images otherwise the image could be adjusted with undesirable results. In the following example the script will execute on cells A:2 to A:5, adjust range accordingly.

Sub URLPictureInsert()
Dim Pshp As Shape
Dim xRg As Range
Dim xCol As Long
On Error Resume Next
Application.ScreenUpdating = False
Set rng = ActiveSheet.Range("A2:A5")
For Each cell In rng
filenam = cell
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
.Top = xRg.Top + (xRg.Height - .Height) / 2
.Left = xRg.Left + (xRg.Width - .Width) / 2
End With
Set Pshp = Nothing
Application.ScreenUpdating = True
End Sub