• DİKKAT

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

combobox

Katılım
29 Ocak 2006
Mesajlar
138
Excel Vers. ve Dili
2003 türkçe
iyi çalışmalar iki gündür uğraşa uğraşa aşağıdaki kodları yazdım ve işimi halledebiliyorum.ama bunu kısaltmanın yolu yokmu? fazla yer kaplamasın diye sınıfların bazısını sildim. 1-den 8 e kadar sınıflar var ve her sıınıfın a,b,c,d şubeleri var.1,2,3. sınıfları sheets("123") yazacak, 4,5,6,7,8.sınıfları sheets("45678") e yazacak.
Private Sub ComboBox1_Change()
If ComboBox1.Value = "1/A" Then
Sheets("123").Range("c2") = ComboBox1.Value
End If
If ComboBox1.Value = "1/B" Then
Sheets("123").Range("c2") = ComboBox1.Value
End If
If ComboBox1.Value = "1/C" Then
Sheets("123").Range("c2") = ComboBox1.Value
End If
If ComboBox1.Value = "1/D" Then
Sheets("123").Range("c2") = ComboBox1.Value
End If
If ComboBox1.Value = "2/A" Then
Sheets("123").Range("c2") = ComboBox1.Value
End If
If ComboBox1.Value = "2/B" Then
Sheets("123").Range("c2") = ComboBox1.Value
End If
If ComboBox1.Value = "2/C" Then
Sheets("123").Range("c2") = ComboBox1.Value
End If
If ComboBox1.Value = "2/D" Then
Sheets("123").Range("c2") = ComboBox1.Value
End If
If ComboBox1.Value = "3/A" Then
Sheets("123").Range("c2") = ComboBox1.Value
End If
If ComboBox1.Value = "4/A" Then
Sheets("45678").Range("C2") = ComboBox1.Value
End If
If ComboBox1.Value = "4/B" Then
Sheets("45678").Range("C2") = ComboBox1.Value
End If
If ComboBox1.Value = "4/C" Then
Sheets("45678").Range("C2") = ComboBox1.Value
End If
If ComboBox1.Value = "4/D" Then
Sheets("45678").Range("C2") = ComboBox1.Value
End If
If ComboBox1.Value = "5/A" Then
Sheets("45678").Range("C2") = ComboBox1.Value
End If
If ComboBox1.Value = "5/B" Then
Sheets("45678").Range("C2") = ComboBox1.Value
End If
If ComboBox1.Value = "5/C" Then
Sheets("45678").Range("C2") = ComboBox1.Value
End If
If ComboBox1.Value = "5/D" Then
Sheets("45678").Range("C2") = ComboBox1.Value
End If

End Sub
 
Aşağıdaki gibi deneyin.

Kod:
Private Sub ComboBox1_Change()
If ComboBox1.ListIndex < 9 Then
Sheets("123").Range("c2") = ComboBox1.Value
Else
Sheets("45678").Range("C2") = ComboBox1.Value
End If
End Sub
 
Kod:
Private Sub ComboBox1_Change()
Select Case ComboBox1.Text
    Case "1/A", "1/B", "1/C", "1/D", "2/A", "2/B", "2/C", "2/D", "3/A"
    Sheets("123").Range("C2") = ComboBox1.Text
    Case "4/A", "4/B", "4/C", "4/D", "5/A", "5/B", "5/C", "5/D"
    Sheets("45678").Range("C2") = ComboBox1.Text
End Select
End Sub
 
teşekkür ederim leventm ve veyselemre.sağolun
 
Geri
Üst