Created
August 11, 2016 12:55
-
-
Save mcnemesis/e1b2beb23d11c0948319538a3e0f72aa to your computer and use it in GitHub Desktop.
Excel VBA Macro to insert image into a cell based on url in another cell
This file contains 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
Sub InstallPictures() | |
Application.ScreenUpdating = False | |
Application.Calculation = xlCalculationManual | |
Dim url_column As Range | |
Dim image_column As Range | |
'column with url... | |
Set url_column = Worksheets(1).UsedRange.Columns("AE") | |
'column where image will be inserted | |
Set image_column = Worksheets(1).UsedRange.Columns("AF") | |
Dim i As Long | |
For i = 2 To url_column.Cells.Count | |
Set Picture = image_column.Worksheet.Pictures.Insert(url_column.Cells(i).Value) | |
Picture.Left = image_column.Cells(i).Left | |
Picture.Top = image_column.Cells(i).Top | |
Picture.Height = 40 | |
image_column.Cells(i).EntireRow.RowHeight = 40 | |
Next | |
Application.ScreenUpdating = True | |
Application.Calculation = xlCalculationAutomatic | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This not getting the pictures from this URL
https://cdn.shopify.com/s/files/1/0965/5800/products/K5104-AF05-anvil-tt-pave-large-slider-with-chain.jpg?v=1541170590
any reason that why its not working.