Hello I am a real beginner on VBA.
I have a workbook on which I managed to create copies of an example sheet and rename the new sheets according to a list.
But now I would like to integrate an image with the same name as the sheet to each newly created sheet. The last step would be to ignore if a sheet has no image related but first i need to figure out what i am doing wrong on this part.
Thanks for the help
PHP Code:
Sub JPG()
Dim i As Long
Dim Image As String
Dim Name As String
Dim Way As String
Image = ".jpg"
Way = "C:\Picture\"
For i = 1 To ActiveWorkbook.Sheets.Count
Sheets(i).Shapes.AddPicture _
Filename:=Way & Sheets(i).Name & Image,
linktofile:=msoFalse, savewithdocument:=msoCTrue, _
Left:=20, Top:=20, Width:=140, Height:=140
Next i
End Sub
Bookmarks