Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub ConvertLinktoImage()
- Application.ScreenUpdating = False
- Dim LastRow As Long
- LastRow = Cells(Rows.Count, 1).End(xlUp).Row
- Dim LastCell As String
- LastCell = "A" & LastRow
- Dim ImageHeight As Long
- Dim RowRange As Range
- Set RowRange = ActiveSheet.Range("A1:" & LastCell)
- Dim ImageShape As Shape
- For Each cell In RowRange
- filenam = cell.Value
- ActiveSheet.Pictures.Insert(filenam).Select
- Set ImageShape = Selection.ShapeRange.Item(1)
- ImageHeight = ImageShape.Height
- With ImageShape
- .LockAspectRatio = msoTrue
- .Cut
- End With
- Cells(cell.Row, cell.Column).PasteSpecial
- cell.RowHeight = ImageHeight
- Next cell
- Application.ScreenUpdating = True
- End Sub
- cell.EntireRow.RowHeight = ImageHeight
- cell.RowHeight = ImageHeight
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement