Hücre yerine textbox

seddur

Altın Üye
Katılım
12 Nisan 2012
Mesajlar
531
Excel Vers. ve Dili
Microsoft office professional plus 2019
Aşağıdaki kod ile N9 hücresine ürün cinsi girildiğinde N10 hücresinde fiyatı buluyor.Yapılmak istenen aranan değerin hücreye değilde Textbox'a girilerek bulunmasıdır.Tabi sonucuda textboxda gösterecek.İlgilenecek arkadaşa teşekkür ederim.


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo hata
Dim KeyCells As Range
Set KeyCells = Range("N9")

If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
If KeyCells.Value <> "" Then
Dim urunBul As Range

Set urunBul = Worksheets("Fiyatlar").UsedRange.Find(KeyCells.Value, Lookat:=xlWhole)
Range("N10") = urunBul.Offset(0, 1).Value

End If

End If
Exit Sub
hata:
Range("N10").Value = "Ürün bulunamadı."
 

Murat OSMA

Altın Üye
Altın Üye
Katılım
23 Mayıs 2011
Mesajlar
5,500
Excel Vers. ve Dili
Microsoft 365 TR-EN
Örnek bir kod yazdım, kendinize uyarlarsınız. TextBox'tan çıkınca çalışır.
PHP:
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    Dim osma As Range
    Set osma = Cells.Find(TextBox1.Value, , , 1)
    If Not osma Is Nothing Then
        Range("A1") = osma.Offset(0, 1).Value
    End If
    Set osma = Nothing
End Sub
 

seddur

Altın Üye
Katılım
12 Nisan 2012
Mesajlar
531
Excel Vers. ve Dili
Microsoft office professional plus 2019
Textboxa sayfadaki aradığım değeri girip sonucu A1 hücresinde görmem gerekiyor değilmi? Bu şekilde çalıştıramadım.
 

seddur

Altın Üye
Katılım
12 Nisan 2012
Mesajlar
531
Excel Vers. ve Dili
Microsoft office professional plus 2019
Tamam sorun yok. Şu an çalıştı.Teşekkür ediyorum.
 

Murat OSMA

Altın Üye
Altın Üye
Katılım
23 Mayıs 2011
Mesajlar
5,500
Excel Vers. ve Dili
Microsoft 365 TR-EN
Rica ederim, iyi akşamlar.
 
Üst