Created
November 12, 2015 11:57
-
-
Save tsohr/76f98f614d5da85ec808 to your computer and use it in GitHub Desktop.
MS Excel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ' http://stackoverflow.com/a/8525125/592817 | |
| Sub InsertImage() | |
| Dim urlColumn As Range | |
| Dim imgColumn As Range | |
| Dim fp As String | |
| Set urlColumn = Worksheets(1).UsedRange.Columns("W") | |
| Set imgColumn = Worksheets(1).UsedRange.Columns("X") | |
| Dim i As Long | |
| For i = 2 To urlColumn.Cells.Count | |
| DoEvents | |
| fp = urlColumn.Cells(i).Text | |
| If (Left(fp, 4) = "http") Then | |
| imgColumn.Cells(i).Select | |
| With imgColumn.Worksheet.Shapes.AddPicture(fp, msoTrue, msoTrue, 1, 1, 96, 96) | |
| .Left = imgColumn.Cells(i).Left | |
| .Top = imgColumn.Cells(i).Top | |
| End With | |
| breakLinks | |
| End If | |
| Debug.Print i, urlColumn.Cells.Count, 100# * i / urlColumn.Cells.Count | |
| Next | |
| End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment