You are on page 1of 1

Sub insertpicture()

Dim pictlist As VAriant, pictformat As String, rng As Range, aShape As Shape

On Error Resume Next

Pictlist=Application.GetopenFilename(pictformat, MultiSelect:=True)
xColindex=Application.ActiveCell.column
If IsArray(pictlist) Then
xRowIndex=Application.ActiveCell.Row

For iLoop = LBound(pictlist) To UBound(pictlist)


Set rng=Cells(xRowIndex, xcolIndex)
Set sShape=ActiveSheet.Shapes.AddPicture(pictlist(iloop), msoFalse, msoTrue,
rng.Left, rng.Top, rng.Width, rng.Height)

'menyesuaikan size gambar


sShape.Select
Selection.ShapeRange.ScaleWidth 0.9090916513, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.9200001167, msoFalse, msoScaleFromTopLeft
Selection.Placement=xlMoveAndSize

sShape.Top=rng.Top + (rng.Height/2)-(sShape.Height/2)
sShape.Left=rng.Left + (rng.width/2)-(sShape.width/2)

xRowIndex = xRowIndex + 1

Next

End If
End Sub

You might also like