Userforma bu özellik eklenebilir mi

Katılım
5 Eylül 2007
Mesajlar
1,247
Excel Vers. ve Dili
ofis 2010
Altın Üyelik Bitiş Tarihi
21-07-2024
Çalışma kitabında KumasC çalışma sayfasının H sütunundaki ürün isimlerini
Kod:
Private Sub ComboBox1_Change()
    Dim S1 As Worksheet, Bul As Range, Son As Long, Veri As Range, Say As Long, Liste()
    
    Set S1 = Sheets("KumasC")
    ReDim Liste(1 To 1)
    Say = 1
    Son = S1.Cells(S1.Rows.Count, "H").End(xlUp).Row
    
    If ComboBox1.Value <> "" Then
        For Each Veri In S1.Range("H4:H" & Son)
            If Veri.Value Like "*" & UCase(Replace(Replace(ComboBox1.Value, "ı", "I"), "i", "İ")) & "*" Then
                ReDim Preserve Liste(1 To Say)
                Liste(Say) = Veri.Value
                Say = Say + 1
            End If
        Next
    
        ComboBox1.List = Liste
        ComboBox1.DropDown
        Erase Liste
    
        Set Bul = S1.Range("H:H").Find(ComboBox1.Value, , xlValues, xlWhole)
        If Not Bul Is Nothing Then
            TextBox6.Value = Format(S1.Cells(Bul.Row, "C"), "#,##0.00")
            TextBox11.Value = Format(Bul.Offset(0, 3), "#,##0.00")
            ComboBox1.DropDown
        End If
    End If
End Sub
user formda bu şekilde seçenekler listeleniyor. merak ettiğim "KumasC" çalışma sayfasındaki ürünlerin bakiyesi sıfır ve altını düştüğünde ürünün ismi "Koşullu biçimlendirme " ile Kırmızıya dönüyor. Dikkatimi çekti bu rengi değişen ürünü userform' da seçerken yani daha seçmeden buradaki kırmızılık orada da görülebilir mi.? yoksa ürün seçtikten sonra bakiyesini zaten görebiliyorum. Eğer olursa başka işlemlerimde kullanabilirim. Teşekkürler
 

Ekli dosyalar

Korhan Ayhan

Administrator
Yönetici
Admin
Katılım
15 Mart 2005
Mesajlar
42,207
Excel Vers. ve Dili
Microsoft 365 Tr-En 64 Bit
Deneyiniz.

Kod:
Private Sub ComboBox1_Change()
    Dim S1 As Worksheet, Bul As Range, Son As Long, Veri As Range, Say As Long, Liste()
    
    Set S1 = Sheets("KumasC")
    ReDim Liste(1 To 1)
    Say = 1
    Son = S1.Cells(S1.Rows.Count, "H").End(xlUp).Row
    
    ComboBox1.BackColor = &H80000005
    
    If ComboBox1.Value <> "" Then
        For Each Veri In S1.Range("H4:H" & Son)
            If Veri.Value Like "*" & UCase(Replace(Replace(ComboBox1.Value, "ı", "I"), "i", "İ")) & "*" Then
                ReDim Preserve Liste(1 To Say)
                Liste(Say) = Veri.Value
                Say = Say + 1
            End If
        Next
    
        ComboBox1.List = Liste
        ComboBox1.DropDown
        Erase Liste
    
        Set Bul = S1.Range("H:H").Find(ComboBox1.Value, , xlValues, xlWhole)
        If Not Bul Is Nothing Then
            TextBox6.Value = Format(S1.Cells(Bul.Row, "C"), "#,##0.00")
            TextBox11.Value = Format(Bul.Offset(0, 3), "#,##0.00")
            If TextBox11.Value < 0 Then
                ComboBox1.BackColor = vbRed
            Else
                ComboBox1.BackColor = &H80000005
            End If
            ComboBox1.DropDown
        End If
    End If
End Sub
 
Katılım
5 Eylül 2007
Mesajlar
1,247
Excel Vers. ve Dili
ofis 2010
Altın Üyelik Bitiş Tarihi
21-07-2024
Sorunsuz çalışıyor

Deneyiniz.

Kod:
Private Sub ComboBox1_Change()
    Dim S1 As Worksheet, Bul As Range, Son As Long, Veri As Range, Say As Long, Liste()
    
    Set S1 = Sheets("KumasC")
    ReDim Liste(1 To 1)
    Say = 1
    Son = S1.Cells(S1.Rows.Count, "H").End(xlUp).Row
    
    ComboBox1.BackColor = &H80000005
    
    If ComboBox1.Value <> "" Then
        For Each Veri In S1.Range("H4:H" & Son)
            If Veri.Value Like "*" & UCase(Replace(Replace(ComboBox1.Value, "ı", "I"), "i", "İ")) & "*" Then
                ReDim Preserve Liste(1 To Say)
                Liste(Say) = Veri.Value
                Say = Say + 1
            End If
        Next
    
        ComboBox1.List = Liste
        ComboBox1.DropDown
        Erase Liste
    
        Set Bul = S1.Range("H:H").Find(ComboBox1.Value, , xlValues, xlWhole)
        If Not Bul Is Nothing Then
            TextBox6.Value = Format(S1.Cells(Bul.Row, "C"), "#,##0.00")
            TextBox11.Value = Format(Bul.Offset(0, 3), "#,##0.00")
            If TextBox11.Value < 0 Then
                ComboBox1.BackColor = vbRed
            Else
                ComboBox1.BackColor = &H80000005
            End If
            ComboBox1.DropDown
        End If
    End If
End Sub
KumaşC 'de ki eksi değerdeki kırmızı yazının Combobox' taki açılır pencerede görülebilmesini sormuştum ama combobox' un rengini değiştirmesi daha kullanışlı olmuş. Teşekkür ederim.
 

Korhan Ayhan

Administrator
Yönetici
Admin
Katılım
15 Mart 2005
Mesajlar
42,207
Excel Vers. ve Dili
Microsoft 365 Tr-En 64 Bit
Açılır listenin kendisine satır bazında müdahale edemiyoruz. Ya hepsi siyah olur, ya da hepsi kırmızı olur.

Bu sebeple seçim yapılan nesnenin rengini değiştirmek daha mantıklı olacaktır.
 
Katılım
5 Eylül 2007
Mesajlar
1,247
Excel Vers. ve Dili
ofis 2010
Altın Üyelik Bitiş Tarihi
21-07-2024
tab ve yön tuşu çalışır mı?

Kod:
Açılır listenin kendisine satır bazında müdahale edemiyoruz. Ya hepsi siyah olur, ya da hepsi kırmızı olur.

Bu sebeple seçim yapılan nesnenin rengini değiştirmek daha mantıklı olacaktır.
Kod:
Private Sub ComboBox1_Change()
    Dim S1 As Worksheet, Bul As Range, Son As Long, Veri As Range, Say As Long, Liste()
    
    Set S1 = Sheets("KumasC")
    ReDim Liste(1 To 1)
    Say = 1
    Son = S1.Cells(S1.Rows.Count, "H").End(xlUp).Row
    
    ComboBox1.BackColor = &H80000005&
    
    If ComboBox1.Value <> "" Then
        For Each Veri In S1.Range("H4:H" & Son)
            If Veri.Value Like "*" & UCase(Replace(Replace(ComboBox1.Value, "ı", "I"), "i", "İ")) & "*" Then
                ReDim Preserve Liste(1 To Say)
                Liste(Say) = Veri.Value
                Say = Say + 1
            End If
        Next
    
        ComboBox1.List = Liste
        ComboBox1.DropDown
        Erase Liste
    
        Set Bul = S1.Range("H:H").Find(ComboBox1.Value, , xlValues, xlWhole)
        If Not Bul Is Nothing Then
            TextBox6.Value = Format(S1.Cells(Bul.Row, "C"), "#,##0.00")
            TextBox11.Value = Format(Bul.Offset(0, 3), "#,##0.00")
            If TextBox11.Value < 0 Then
                ComboBox1.BackColor = vbRed
            Else
                ComboBox1.BackColor = &H80000005&
            End If
            ComboBox1.DropDown
        End If
    End If
End Sub
Korhan bey kodu kullanıyorum ama bir sıkıntı yaşıyorum, aranacak ürün yazdığımda açılır pencere açılıyor ama ancak mause ile seçebiliyorum. tab ve aşağı yön tuşunu kullanmak benim için daha pratik olacak. Öyle bir ayar varmıdır acaba .
 

Korhan Ayhan

Administrator
Yönetici
Admin
Katılım
15 Mart 2005
Mesajlar
42,207
Excel Vers. ve Dili
Microsoft 365 Tr-En 64 Bit
Listeden hızlı seçim yapabilmeniz için ListBox nesnesini kullanmanız daha akıllıca görünüyor.
 
Üst