- Katılım
- 23 Eylül 2004
- Mesajlar
- 1,754
- Excel Vers. ve Dili
- Excel 2010 TR
Kod:
Sub Tıkla()
Dim sPicture As String, pic As Picture
For i = 1 To 10
Cells(i, 5).Select
aaa = Range("E" & i).Value
sPicture = ("C:\Users\huseyin\Pictures\" & aaa & ".gif")
On Error GoTo atla3:
GoTo atla2:
atla3:
sPicture = ("C:\Users\huseyin\Pictures\none.gif")
atla2:
Set pic = ActiveSheet.Pictures.Insert(sPicture)
With pic
.ShapeRange.LockAspectRatio = msoFalse
.Height = ActiveCell.Height
.Width = ActiveCell.Width
.Top = ActiveCell.Top
.Left = ActiveCell.Left
.Placement = xlMoveAndSize
End With
Set pic = Nothing
Next i
End Sub
On Error GoTo atla3:
Bu işlem eğer istenilen isimde resim yoksa ilk hata için çalışıyo fakat next döngüsü başa donup 2 kez hata verdiğinde işlem yapmıyor. verilen linkte resim olup olmadığını başka nasıl kontrol edebilirim.
