在R列的excel文件中有图片网址列表
https://pp.com/phoo/018XXXX.jpg
https://pp.com/phoo/018uuuu.jpg
https://pp.com/phoo/0183333.jpg
现在从不同的建议(主要是帮助形式stackoverflow)我在宏中创建模块和下面的示例代码
Sub InsertPic()
Dim pic As String 'file path of pic
Dim myPicture As Picture 'embedded pic
Dim rng As Range 'range over which we will iterate
dim cl As Range 'iterator
Set rng = Range("R1:R3")
For Each cl In rng
pic = cl.Offset(0, -1)
Set myPicture = ActiveSheet.Pictures.Insert(pic)
With myPicture
.ShapeRange.LockAspectRatio = msoFalse
.Width = cl.Width
.Height = cl.Height
.Top = Rows(cl.Row).Top
.Left = Columns(cl.Column).Left
End With
Next
End Sub
请帮我查一下错误?我对VBA一无所知。仅针对此问题,我使用VBA代码。如果我花一些时间来解决它,我将不胜感激。