Excel图片链接转为图片展示

2020-03-03  本文已影响0人  yellow_han

1、excel另存为宏的工作簿

2、alt+F11打开视图输入以下代码,然后文件保存

i=2表示从第二行开始便利。Cells(i, 6)指的是图片链接所在位置(列)。Cells(i, 9)指的是图片展示的位置(列)。
Sub 宏11()
Application.ScreenUpdating = False
For i = 2 To Range("A65536").End(xlUp).Row 
 If Cells(i, 6) <> 0 Then
Cells(i, 9).RowHeight = 100 '设置行高为100
Cells(i, 9).Select
ActiveSheet.Pictures.Insert(Cells(i, 6).Value).Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = Cells(i, 9).Height '设置图片高度为单元格行高
Cells(i, 9).ClearContents
 End If
Next
Application.ScreenUpdating = True
End Sub
上一篇 下一篇

猜你喜欢

热点阅读