Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. Sub ConvertLinktoImage()
  2. Application.ScreenUpdating = False
  3.  
  4. Dim LastRow As Long
  5. LastRow = Cells(Rows.Count, 1).End(xlUp).Row
  6.  
  7. Dim LastCell As String
  8. LastCell = "A" & LastRow
  9.  
  10. Dim ImageHeight As Long
  11. Dim RowRange As Range
  12. Set RowRange = ActiveSheet.Range("A1:" & LastCell)
  13.  
  14. Dim ImageShape As Shape
  15.  
  16. For Each cell In RowRange
  17. filenam = cell.Value
  18. ActiveSheet.Pictures.Insert(filenam).Select
  19. Set ImageShape = Selection.ShapeRange.Item(1)
  20. ImageHeight = ImageShape.Height
  21. With ImageShape
  22. .LockAspectRatio = msoTrue
  23. .Cut
  24. End With
  25.  
  26. Cells(cell.Row, cell.Column).PasteSpecial
  27. cell.RowHeight = ImageHeight
  28. Next cell
  29.  
  30. Application.ScreenUpdating = True
  31. End Sub
  32.  
  33. cell.EntireRow.RowHeight = ImageHeight
  34.  
  35. cell.RowHeight = ImageHeight
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement