SerenityNetworks
Board Regular
- Joined
- Aug 13, 2009
- Messages
- 131
- Office Version
- 365
- Platform
- Windows
Sorry, it's been too long since I've fooled with VBA. I've forgotten how to loop.
I can the simple code below to display a picture in Cell B1 from the URL in C1. But the URLs in Column-C actually start at C9 and go to an indefinite number of rows. In one worksheet there may be 10 rows with URLs in Column-C. In another worksheet there may be 100 rows with URLs in Column-C. There will be no blank cells between C9 and the end of Column-C. How do I modify the macro below to loop through so each row B9 and down is populated with a picture from the URL on the same row in Column-C?
Thanks in advance,
Andrew
I can the simple code below to display a picture in Cell B1 from the URL in C1. But the URLs in Column-C actually start at C9 and go to an indefinite number of rows. In one worksheet there may be 10 rows with URLs in Column-C. In another worksheet there may be 100 rows with URLs in Column-C. There will be no blank cells between C9 and the end of Column-C. How do I modify the macro below to loop through so each row B9 and down is populated with a picture from the URL on the same row in Column-C?
Thanks in advance,
Andrew
Code:
Sub Test()
Dim Pic As Picture
Application.ScreenUpdating = False
With ActiveSheet.Range("C1")
Set Pic = .Parent.Pictures.Insert(.Value)
With .Offset(, -1)
Pic.Top = .Top
Pic.Left = .Left
Pic.Height = .Height
Pic.Width = .Width
End With
End With
Application.ScreenUpdating = True
End Sub