Hey So i have a matrix of URLs, they are in columns K L M N. Not every cell has a URL some are blank. Ideally i would like to print the image to the cell the URL is in and resize to thumbnail size.
Using some of the code on this site ive managed to get the first column working well. However when i try to 'replicate' it on column L it just does nothing. K works and i dont get an error code but it never gets the L images.
Anyone know where im messing up? I'm pretty noob at VBA really just copy pasting and trying to work through it logically but guess im missing a piece. Any help would be greatly appreciated!!
Using some of the code on this site ive managed to get the first column working well. However when i try to 'replicate' it on column L it just does nothing. K works and i dont get an error code but it never gets the L images.
Anyone know where im messing up? I'm pretty noob at VBA really just copy pasting and trying to work through it logically but guess im missing a piece. Any help would be greatly appreciated!!
Sub IMAGE()
Dim Rng As Range
Dim Cell As Range
Dim Pic As picture
Application.ScreenUpdating = False
Columns("k:k").ColumnWidth = 21.29
Set Rng = Range("K3:K" & Range("k" & Rows.Count).End(xlUp).Row)
For Each Cell In Rng
With Cell
On Error Resume Next
Set Pic = .Parent.Pictures.Insert(.Value)
If Err <> 0 Then
Err.Clear
Else
With .Offset(0, 0)
Pic.Top = .Top
Pic.Left = .Left
Pic.Height = .Height
Pic.Width = .Width
End With
End If
On Error GoTo 0
End With
Next Cell
' not sure why this one isnt working......
Columns("l:l").ColumnWidth = 21.29
Set Rng = Range("L3:L" & Range("L" & Rows.Count).End(xlUp).Row)
For Each Cell In Rng
With Cell
On Error Resume Next
Set Pic = .Parent.Pictures.Insert(.Value)
If Err <> 0 Then
Err.Clear
Else
With .Offset(0, 0)
Pic.Top = .Top
Pic.Left = .Left
Pic.Height = .Height
Pic.Width = .Width
End With
End If
On Error GoTo 0
End With
Next Cell
Rows("3:11").RowHeight = 153
Application.ScreenUpdating = True
End Sub