• DİKKAT

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

Combobox'tan Textbox'a veri

sukruyilmaz1

Altın Üye
Katılım
19 Haziran 2008
Mesajlar
301
Excel Vers. ve Dili
Office 365
Merhabalar saygı değer Uzman arkadaşlarım.

Ekte yüklediğim excel sayfasında derdimi anlatmaya çalıştım. Combobox'daki seçilen değere göre textboxların otomatik dolmasını istiyorum. Eğer 100 seçersem yüzlük demire göre yazdığım değerlerin textbox'a gelmesini istiyorum. Eğer 80 veya 65 seçersem de ona göre karşılıklarının textboxlara gelmesini istiyorum.

Yardımcı olabilirseniz şimdiden çok teşekkür ederim.
 

Ekli dosyalar

VBE şifreli.
Şifreyi çözüp dosyayı yollarsanız , yapacak olan arkadaşlar olacaktır diye umuyorum.:cool:
 
biraz uğraşarak şu kodu yazdım. uzun oldu muhtemelen kısa bir kodu vardır :)

Private Sub ComboBox1_Change()

If ComboBox1.Text = "100" Then TextBox18.Value = "22"
If ComboBox1.Text = "100" Then TextBox19.Value = "22"
If ComboBox1.Text = "100" Then TextBox20.Value = "12"
If ComboBox1.Text = "100" Then TextBox25.Value = "131"
If ComboBox1.Text = "100" Then TextBox26.Value = "12"
If ComboBox1.Text = "100" Then TextBox27.Value = "3"
If ComboBox1.Text = "100" Then TextBox28.Value = "8"
If ComboBox1.Text = "100" Then TextBox29.Value = "20"
If ComboBox1.Text = "100" Then TextBox24.Value = "2,4"
If ComboBox1.Text = "100" Then TextBox31.Value = "4"
If ComboBox1.Text = "100" Then TextBox32.Value = "20"
If ComboBox1.Text = "100" Then TextBox30.Value = "2,40"

If ComboBox1.Text = "80" Then TextBox18.Value = "12"
If ComboBox1.Text = "80" Then TextBox19.Value = "24"
If ComboBox1.Text = "80" Then TextBox20.Value = "12"
If ComboBox1.Text = "80" Then TextBox25.Value = "131"
If ComboBox1.Text = "80" Then TextBox26.Value = "12"
If ComboBox1.Text = "80" Then TextBox27.Value = "2,40"
If ComboBox1.Text = "80" Then TextBox28.Value = "8"
If ComboBox1.Text = "80" Then TextBox29.Value = "20"
If ComboBox1.Text = "80" Then TextBox24.Value = "2,4"
If ComboBox1.Text = "80" Then TextBox31.Value = "4"
If ComboBox1.Text = "80" Then TextBox32.Value = "20"
If ComboBox1.Text = "80" Then TextBox30.Value = "2,40"

If ComboBox1.Text = "65" Then TextBox18.Value = "11"
If ComboBox1.Text = "65" Then TextBox19.Value = "20"
If ComboBox1.Text = "65" Then TextBox20.Value = "12"
If ComboBox1.Text = "65" Then TextBox25.Value = "131"
If ComboBox1.Text = "65" Then TextBox26.Value = "12"
If ComboBox1.Text = "65" Then TextBox27.Value = "1,95"
If ComboBox1.Text = "65" Then TextBox28.Value = "8"
If ComboBox1.Text = "65" Then TextBox29.Value = "16"
If ComboBox1.Text = "65" Then TextBox24.Value = "2,4"
If ComboBox1.Text = "65" Then TextBox31.Value = "4"
If ComboBox1.Text = "65" Then TextBox32.Value = "20"
If ComboBox1.Text = "65" Then TextBox30.Value = "2,40"
 
Dosyanız ektedir.:cool:
Kod:
Private Sub ComboBox1_Change()
Dim aralik As Range, hcr As Range, mytag As Byte
Dim nesne As Object, deg
If ComboBox1.Value = "" Then Exit Sub
If ComboBox1.Value = 100 Then
    Set aralik = Range("V3:X7")
ElseIf ComboBox1.Value = 80 Then
    Set aralik = Range("V12:X16")
ElseIf ComboBox1.Value = 65 Then
    Set aralik = Range("V21:X25")
End If

For Each hcr In aralik
    mytag = CByte(mytag) + 1
    For Each nesne In Me.Controls
        If TypeName(nesne) = "TextBox" Then
            If IsNumeric(nesne.Tag) Then
                If mytag = nesne.Tag Then
                    If mytag Mod 3 = 0 Then
                        nesne = VBA.Format(hcr.Value, "#0.00")
                    Else
                        nesne = hcr.Value
                    End If
                    Exit For
                End If
            End If
        End If
    Next nesne
Next hcr
    
End Sub
 

Ekli dosyalar

Geri
Üst