DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Private Sub Worksheet_Change(ByVal Target As Range)
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [B:B]) Is Nothing Then Exit Sub
Dim ResimYolu As Variant
Dim resim As Object
Dim Satir As Integer
If Target = "" Then Exit Sub
Satir = Target.Row
' Hata Kontrolü
'On Error GoTo çıkış
' Resimleri Sil
ActiveSheet.DrawingObjects.Delete
'Resim yolu bulunması
ResimYolu = ActiveWorkbook.Path & "\" & Range("B" & Satir) & ".jpg"
' Resmi Oluştur
If Dir(ResimYolu) = "" Then
MsgBox "Resim: '" & ResimYolu & "' bulunamıyor. Dosya adını ve yolunu kontrol ediniz.", vbCritical
Exit Sub
End If
Set resim = ActiveSheet.Pictures.Insert(ResimYolu)
' Resmi Boyutlandır
With Range("d" & Satir + 1)
resim.Top = .Top
resim.Left = .Left
resim.Height = .Height
resim.Width = .Width
End With
çıkış:
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, [B:B]) Is Nothing Then Exit Sub
Dim ResimYolu As Variant
Dim resim As Picture
Dim Satir As Integer
Dim ResimBak As Integer
If Target = "" Then Exit Sub
Satir = Target.Row
If DrawingObjects.Count > 0 Then
For ResimBak = 1 To DrawingObjects.Count
If DrawingObjects(ResimBak).Name = Target.Text Then
DrawingObjects(ResimBak).Delete
Exit For
End If
Next
End If
ResimYolu = ActiveWorkbook.Path & "\" & Target.Text & ".jpg"
If Dir(ResimYolu) = "" Then
MsgBox "Resim: '" & ResimYolu & "' bulunamıyor. Dosya adını ve yolunu kontrol ediniz.", vbCritical
Exit Sub
End If
Set resim = ActiveSheet.Pictures.Insert(ResimYolu)
With Range("d" & Satir + 1)
resim.Top = .Top
resim.Left = .Left
resim.Height = .Height
resim.Width = .Width
resim.Name = Target.Text
End With
çıkış:
End Sub