tonywatsonhelp
Well-known Member
- Joined
- Feb 24, 2014
- Messages
- 3,210
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
Hi Everyone,
I was woundering if anyone know a quicker way to insert images from urls into a sheet,
this currently take about two hours to run on 5000 lines
any suggestions would be greatly apreciated.
hears the code i currently use?
I was woundering if anyone know a quicker way to insert images from urls into a sheet,
this currently take about two hours to run on 5000 lines
any suggestions would be greatly apreciated.
hears the code i currently use?
VBA Code:
Sub Hyperlink_Insert()
Dim Pshp As Shape
Dim xRg As Range
Dim xCol As Long
On Error Resume Next
Application.ScreenUpdating = False
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
If Left(shp.Name, 7) = "Picture" Then
shp.Delete
End If
Next shp
lr1 = Thum.Cells(Rows.Count, "B").End(xlUp).Row
If lr1 <= 10 Then
lr1 = 10
End If
Set rng = Thum.Range("B10:B" & lr1)
For Each cell In rng
Application.StatusBar = "Progress: " & cell.Row & " of " & lr1
filenam = cell
Thum.Pictures.Insert(filenam).Select
Set Pshp = Selection.ShapeRange.Item(1)
If Pshp Is Nothing Then GoTo lab
xCol = cell.Column
Set xRg = Cells(cell.Row, xCol)
With Pshp
.LockAspectRatio = msoTrue
.Height = xRg.Height * 0.9
.Top = xRg.Top + (xRg.Height - .Height) / 2
.Left = xRg.Left + (xRg.Width - .Width) / 2
' .OnAction = "Picture_Click_Big"
End With
lab:
Set Pshp = Nothing
Range("A1").Select
Next
Application.ScreenUpdating = True
Application.StatusBar = False
End Sub