• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Hücre yerine textbox

Katılım
12 Nisan 2012
Mesajlar
533
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ı."
 
Ö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
 
Textboxa sayfadaki aradığım değeri girip sonucu A1 hücresinde görmem gerekiyor değilmi? Bu şekilde çalıştıramadım.
 
Tamam sorun yok. Şu an çalıştı.Teşekkür ediyorum.
 
Rica ederim, iyi akşamlar.
 
Geri
Üst