• DİKKAT

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

If then Else

  • Konbuyu başlatan Konbuyu başlatan mkstyle
  • Başlangıç tarihi Başlangıç tarihi
Katılım
31 Ağustos 2009
Mesajlar
44
Excel Vers. ve Dili
office 2007-trkçe
Arkadaşlar form üzerinde bir textbox ve bir combobox var. Combobox içeriği
0,31-1,50
1,51-3,00
3,01-6,00
6,01-9,00
9,01-12,00
12,01-15,00
15,01-20,00

Textbox'a bir değer girdiğimde; örneğin 2,65 olsun
Combobox da 1,51-3,00 olarak görünsün istiyorum. Form üzerinde çalışyorum. Şöyle bir kod yazdım ama hata veriyor.

If TextBox12.Text >= "0,31" Or TextBox12.Text <= "1,5" Then GovdeDolguComboBox.Value = "0,31-1,50"
ElseIf TextBox12.Text >= "1,51" Or TextBox12.Text <= "3,0" Then GovdeDolguComboBox.Value = "1,51-3,00"
ElseIf TextBox12.Text >= "3,01" Or TextBox12.Text <= "6,0" Then GovdeDolguComboBox.Value = "3,01-6,00"
ElseIf TextBox12.Text >= "6,01" Or TextBox12.Text <= "9,0" Then GovdeDolguComboBox.Value = "6,01-9,00"
ElseIf TextBox12.Text >= "9,01" Or TextBox12.Text <= "12,0" Then GovdeDolguComboBox.Value = "9,01-12,00"
ElseIf TextBox12.Text >= "12,01" Or TextBox12.Text <= "15,0" Then GovdeDolguComboBox.Value = "12,01-15,00"
ElseIf TextBox12.Text >= "15,01" Or TextBox12.Text <= "20,0" Then GovdeDolguComboBox.Value = "15,01-20,00"
End If

Yardımlarınızı bekliyorum. Saygılar
 
Merhaba,
Aşağıdaki şekilde dener misiniz?
Kod:
Private Sub CommandButton1_Click()
    GovdeDolguComboBox.Value = ""
    a = Val(TextBox12.Text)
    If a >= 0.31 And a <= 1.5 Then
        GovdeDolguComboBox.Value = "0.31 - 1.5"
    ElseIf a >= 1.51 And a <= 3 Then
        GovdeDolguComboBox.Value = "1.51 - 3.0"
    ElseIf a >= 3.01 And a <= 6 Then
        GovdeDolguComboBox.Value = "3.01 - 6.0"
    ElseIf a >= 6.01 And a <= 9 Then
        GovdeDolguComboBox.Value = "6.01 - 9.0"
    ElseIf a >= 9.01 And a <= 12 Then
        GovdeDolguComboBox.Value = "9.01 - 12.0"
    ElseIf a >= 12.01 And a <= 15 Then
        GovdeDolguComboBox.Value = "12.01 - 15.0"
    ElseIf a >= 15.01 And a <= 20 Then
        GovdeDolguComboBox.Value = "15.01 - 20.0"
    End If
End Sub
 
If Then Else

Sayın DEDE. İlginize çok teşekkür ederim. Kodlar tam istediğim gibi oldu. Sağolun.
 
Geri
Üst