1 Attachment(s)
Insert Different Picture into Multiple Sheets
hi all...
how to inserting different 3 pictures in different cell and different sheets ( i have over 50 sheets in 1 file)
Code:
Sub InsertPic() Dim I As Long
Dim xPath As String
Dim xShape As Shape
Dim xRg As Range
xPath = "G:\foto_test\1.jpg,2.jpg,3.jpg"
If Dir(xPath) = "" Then
MsgBox "Picture file was not found in path!", vbInformation, "test"
Exit Sub
End If
For I = 1 To ActiveWorkbook.Sheets.Count
Set xRg = Sheets(I).Range("B10:C10") ("D10:E10") ("f10:g10")
Set xShape = Sheets(I).Shapes.AddPicture(xPath, True, True, xRg.Left, xRg.Top, xRg.Width, xRg.Height)
Next End Sub
file name of picture are e.g. 1.jpg, 2.jpg,3.jpg
my target is how to insert picture in cell with criteria :
1.jpg----inserted into cell B10:C10 for each sheet
2.jpg----inserted into cell D10:E10 for each sheet
3.jpg----inserted into cell F10:G10 for each sheet
anybody would help me and greatly appreciated
susanto