Soru İki farklı sütundan veri alma ve Comboboxlarda aynı veriye izin vermeme

sirkülasyon

Altın Üye
Katılım
10 Temmuz 2012
Mesajlar
2,518
Excel Vers. ve Dili
2021 LTSC TR
Altın Üyelik Bitiş Tarihi
18-06-2026
Private Sub UserForm_Activate() Prosedürünün içine aldığım kod
Kod:
    Dim X As Long
    For X = 2 To 500
     If TextBox3 <> "Özel Eğitim" Then: If Sheets("VERİLER").Cells(X, "AH") <> "" Then ComboBox3.AddItem Sheets("VERİLER").Cells(X, "AH")
     If TextBox3 = "Özel Eğitim" Then: If Sheets("VERİLER").Cells(X, "AL") <> "" Then ComboBox3.AddItem Sheets("VERİLER").Cells(X, "AL")
    Next
Private Sub ComboBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean) Prosedürünün içine aldığım kod
Kod:
On Error Resume Next
ComboBox4.Clear
Set S1 = Sheets("VERİLER")
If TextBox3 <> "Özel Eğitim" Then
For i = 2 To S1.Cells(65536, "AH").End(xlUp).Row
If S1.Cells(i, 34) <> ComboBox3 Then
ComboBox3.AddItem S1.Cells(i, 34).Value
End If
Next
End If

If TextBox3 = "Özel Eğitim" Then
ComboBox3.Clear
Set S1 = Sheets("VERİLER")
For i = 2 To S1.Cells(65536, "AL").End(xlUp).Row
If S1.Cells(i, 38) <> ComboBox3 Then
ComboBox4.AddItem S1.Cells(i, 38).Value
End If
Next
End If
End Sub
Yapmak istediğim ise şu:
TextBox3 = "Özel Eğitim" ise
ComboBox3 ve Combobox4 VERİLER sayfası AL sütununda veri alsın
Combobox3 de olan veri Combobox4' de olmasın
TextBox3 = "Özel Eğitim" değil ise
ComboBox3 ve Combobox4 VERİLER sayfası AH sütununda veri alsın
Combobox3 de olan veri Combobox4' de olmasın
Rica etsem yardımda bulunabilir misiniz? Teşekkür ederim
 
Üst