tahsinanarat
Altın Üye
- Katılım
- 14 Mart 2005
- Mesajlar
- 2,168
- Excel Vers. ve Dili
- Ofis 2019 Türkçe
- Altın Üyelik Bitiş Tarihi
- 27-05-2028
Aşağıdaki kodlar aynı sayfanın kod bölümünde olması gerekiyor,ancak çalıştırırken hata alıyorum, ikisini bir arada nasıl kullanabilirim. Saygılarımla
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.CutCopyMode = xlCopy Then Exit Sub
If Application.CutCopyMode = xlCut Then Exit Sub
On Error Resume Next
If Intersect(Target, [B:B]) Is Nothing Then GoTo son
If Target.Address = "$B$1" Then Exit Sub
If Target.Offset(0, -1).Value & ".JPG" <> "" Then
If UCase(Right(Target.Offset(0, -1).Value & ".JPG", 3)) = "JPG" Or UCase(Right(Target.Offset(0, -1).Value & ".BMP", 3)) = "BMP" Then
Image1.Top = Target.Offset(0, 1).Top
Image1.Left = Target.Offset(0, 1).Left
If Not Image1.Visible Then Image1.Visible = True
If Dir(Cells(1, 18) & Target.Offset(0, -1).Value & ".JPG") <> "" Then
Image1.Picture = LoadPicture(Cells(1, 18) & Target.Offset(0, -1).Value & ".JPG")
Image1.AutoSize = True
Else
Image1.Picture = Empty
Image1.Visible = False
Image1.Picture = Nothing
End If
Else
GoTo son
End If
End If
Exit Sub
son:
Image1.Visible = False
Image1.Picture = Nothing
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo son
If Intersect(Target, [a:a]) Is Nothing Then Exit Sub
If Target.Value = "" Then
Target.Interior.ColorIndex = xlNone
Target.Offset(0, 1) = ""
Else
Set Bul = Sheets("liste").Columns("a").Find(Target, lookat:=xlWhole)
If Bul Is Nothing Then
Target.Interior.ColorIndex = 3
Target.Offset(0, 1) = ""
MsgBox Target.Value & " Degerini Bulamadim "
Else
Target.Interior.ColorIndex = xlNone
Target.Offset(0, 1) = Sheets("Liste").Cells(Bul.Row, "b")
Target.Offset(0, 2) = Sheets("liste").Cells(Bul.Row, "c")
Target.Offset(0, 3) = Sheets("liste").Cells(Bul.Row, "f")
End If
End If
son:
End Sub
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Application.CutCopyMode = xlCopy Then Exit Sub
If Application.CutCopyMode = xlCut Then Exit Sub
On Error Resume Next
If Intersect(Target, [B:B]) Is Nothing Then GoTo son
If Target.Address = "$B$1" Then Exit Sub
If Target.Offset(0, -1).Value & ".JPG" <> "" Then
If UCase(Right(Target.Offset(0, -1).Value & ".JPG", 3)) = "JPG" Or UCase(Right(Target.Offset(0, -1).Value & ".BMP", 3)) = "BMP" Then
Image1.Top = Target.Offset(0, 1).Top
Image1.Left = Target.Offset(0, 1).Left
If Not Image1.Visible Then Image1.Visible = True
If Dir(Cells(1, 18) & Target.Offset(0, -1).Value & ".JPG") <> "" Then
Image1.Picture = LoadPicture(Cells(1, 18) & Target.Offset(0, -1).Value & ".JPG")
Image1.AutoSize = True
Else
Image1.Picture = Empty
Image1.Visible = False
Image1.Picture = Nothing
End If
Else
GoTo son
End If
End If
Exit Sub
son:
Image1.Visible = False
Image1.Picture = Nothing
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo son
If Intersect(Target, [a:a]) Is Nothing Then Exit Sub
If Target.Value = "" Then
Target.Interior.ColorIndex = xlNone
Target.Offset(0, 1) = ""
Else
Set Bul = Sheets("liste").Columns("a").Find(Target, lookat:=xlWhole)
If Bul Is Nothing Then
Target.Interior.ColorIndex = 3
Target.Offset(0, 1) = ""
MsgBox Target.Value & " Degerini Bulamadim "
Else
Target.Interior.ColorIndex = xlNone
Target.Offset(0, 1) = Sheets("Liste").Cells(Bul.Row, "b")
Target.Offset(0, 2) = Sheets("liste").Cells(Bul.Row, "c")
Target.Offset(0, 3) = Sheets("liste").Cells(Bul.Row, "f")
End If
End If
son:
End Sub