我正在使用excel 2010,我想创建一个函数,该函数将url作为参数并将图像插入到它的左侧。如果网址单元格为空,则可能会发生错误。
这些是我的测试网址:
https://img.reuter.de/products/ge/500x500/geberit-aquaclean-mera-comfort-wc-komplettanlage-weiss--ge-146210111_7c.jpg
https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/NorthYorkHouse2.JPG/220px-NorthYorkHouse2.JPG
https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Flower_poster_2.jpg/330px-Flower_poster_2.jpg
我的功能如下:
Function displayImage(url)
Dim url_column As Range
Dim image As Range
With image.Worksheet.Pictures.Insert(url.Value)
.Left = image.Cells(i).Left
.Top = image.Cells(i).Top
image.Cells(i).EntireRow.RowHeight = .Height
End With
End Function
如上图所示,我得到#VALUE
。有什么建议我做错了吗?
感谢您的答复!