DataBlake
Well-known Member
- Joined
- Jan 26, 2015
- Messages
- 781
- Office Version
- 2016
- Platform
- Windows
Code:
Sub URLPictureInsert()
Dim Pshp As Shape
Dim i As Long
Dim lastRow As Long
Dim urlRng As Range
Dim trgtRng As Range
lastRow = Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lastRow
Set urlRng = Range("B" & i)
Set trgtRng = Range("C" & i)
If urlRng = "" Then Range("H" & i).Value = 0
If urlRng = "" Then GoTo lastline
filenam = urlRng
On Error Resume Next
ActiveSheet.Pictures.Insert(filenam).Select
On Error Resume Next
Set Pshp = Selection.ShapeRange.Item(1)
If Pshp Is Nothing Then GoTo lab
Range("H" & i).Value = 1
With Pshp
.LockAspectRatio = msoFalse
.Width = 15
.Height = 15
.Top = trgtRng.Top
.Left = trgtRng.Left
End With
lab:
If Pshp Is Nothing Then Range("H" & i).Value = 0
Set Pshp = Nothing
lastline:
Next i
End Sub
is there anything i can do to this code that will make it go faster?
i understand that deleting the ".select" would make it faster, but i'm unsure of what the alternative is?
and how much time would screen updating = false save?
Last edited: