我有一个以这种方式构建的工作表:
A |B |C
-------------
Item1|Url |
Item2|Url |
Item3|Url |
我需要实现的是读取每个URL并将图像放入C列中的每个单元格。我现在的代码如下:
Sub sg()
Dim i As Integer
Dim urlImg As String
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("Sheet1")
Dim rowCount As Long
rowCount = sh.Range("A1", sh.Range("A1").End(xlDown)).Rows.Count
MsgBox (rowCount)
For i = 2 To rowCount
urlImg = Cells(i, 3).Value
Cells(i, 3).RowHeight = Range("b" & i).offset(rowOffset:=0, columnOffset:=0).Top + 5
alto = Range("b" & i).offset(rowOffset:=0, columnOffset:=0).Top + 5
sinistra = Range("b" & i).offset(rowOffset:=0, columnOffset:=0).Left + 5
ridimensionamentoAltezza = Range("b" & i).offset(rowOffset:=0, columnOffset:=0).Height - 10
ridimensionamentoLarghezza = Range("b" & i).offset(rowOffset:=0, columnOffset:=0).Width - 10
With ActiveSheet.Pictures.Insert(urlImg)
.Top = alto
.Left = sinistra
.Height = ridimensionamentoAltezza
.Width = ridimensionamentoLarghezza
End With
Next i
End Sub
到目前为止工作,我可以得到图像,但当然现在是将所有图片放在彼此之上......我无法找到一种方法将每张图片放在一个之后...任何帮助?