• DİKKAT

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

Koşullu Kod Çalıştırma

Katılım
12 Nisan 2014
Mesajlar
72
Excel Vers. ve Dili
Microsoft 365 Enterprise En 64 Bit
Merhaba,

Aşağıda kırmızı renkte belirtmiş olduğum kodlar userformda seçim yapılmamış alan var ise uyarı veriyor. Benim istediğim eğer bu kırmızı kodlar uyarı verirse siyah renkte ki kodlar çalışmasın. Uyarı vermezse (Tüm şeçimler yapılmışsa uyarı vermiyor) siyah olan kodlar çalışıp görevini yapsın.

Birkaç konuya baktım ancak kendi kodlarım üzerine uygulayamadım.

Desteğinizi rica ederim
iyi çalışmalar

Kod:
Private Sub CommandButton1_Click()
[COLOR="Red"]Dim intTextBox As Integer
For intTextBox = 1 To 2
If Controls("TextBox" & intTextBox) = "" Then
MsgBox "TextBox" & intTextBox & " Manuel alanlardan birini boş bıraktın!"
Exit For
End If
Next intTextBox
Dim intComboBox As Integer
For intComboBox = 1 To 2
If Controls("ComboBox" & intComboBox).ListIndex = -1 Then
MsgBox "ComboBox" & intComboBox & " ComboBox'lardan birini boş bıraktın!"
Exit For
End If
Next intComboBox
Dim intListBox As Integer
For intListBox = 1 To 2
If Controls("ListBox" & intListBox).ListIndex = -1 Then
MsgBox "ListBox" & intListBox & " ListBox'lardan birini boş bıraktın!"
Exit For
End If
Next intListBox[/COLOR]


Sheets("Data").Select
Range("a2").Select
Do While Not IsEmpty(ActiveCell)
    ActiveCell.Offset(1, 0).Select
Loop
If Range("a2").Value = "" Then
    Range("a2").Value = 1
    Range("a2").Select
Else
    ActiveCell.Value = ActiveCell.Offset(-1, 0) + 1
End If
ActiveCell.Offset(0, 1) = TextBox1.Text
ActiveCell.Offset(0, 2) = ListBox1.Text
ActiveCell.Offset(0, 3) = ListBox2.Text
ActiveCell.Offset(0, 4) = TextBox2.Text
ActiveCell.Offset(0, 5) = ComboBox7.Text
ActiveCell.Offset(0, 6) = ComboBox8.Text
ActiveCell.Offset(0, 7) = ComboBox9.Text
ActiveCell.Offset(0, 8) = ComboBox10.Text
ActiveCell.Offset(0, 9) = ComboBox11.Text
ActiveCell.Offset(0, 10) = ComboBox12.Text
ActiveCell.Offset(0, 11) = ComboBox13.Text
ActiveCell.Offset(0, 12) = ComboBox14.Text
ActiveCell.Offset(0, 13) = ComboBox15.Text
ActiveCell.Offset(0, 14) = ComboBox16.Text
ActiveCell.Offset(0, 15) = ComboBox1.Text
ActiveCell.Offset(0, 16) = ComboBox2.Text
ActiveCell.Offset(0, 17) = ComboBox3.Text
ActiveCell.Offset(0, 18) = ComboBox4.Text
ActiveCell.Offset(0, 19) = ComboBox5.Text
ActiveCell.Offset(0, 20) = ComboBox6.Text
ActiveCell.Offset(0, 21) = ComboBox17.Text
ActiveCell.Offset(0, 22) = ComboBox18.Text
ActiveCell.Offset(0, 23) = ComboBox19.Text
ActiveCell.Offset(0, 24) = ComboBox20.Text
ActiveCell.Offset(0, 25) = TextBox3.Text
ActiveCell.Offset(0, 26) = TextBox4.Text
ActiveCell.Offset(0, 27) = ComboBox21.Text
ActiveCell.Offset(0, 28) = ComboBox22.Text
ActiveCell.Offset(0, 29) = ComboBox23.Text
ActiveCell.Offset(0, 30) = ComboBox24.Text



TextBox1.Text = ""
ListBox1.Text = ""
ListBox2.Text = ""
TextBox2.Text = ""
ComboBox7.Text = ""
ComboBox8.Text = ""
ComboBox9.Text = ""
ComboBox10.Text = ""
ComboBox11.Text = ""
ComboBox12.Text = ""
ComboBox13.Text = ""
ComboBox14.Text = ""
ComboBox15.Text = ""
ComboBox16.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""
ComboBox5.Text = ""
ComboBox6.Text = ""
ComboBox17.Text = ""
ComboBox18.Text = ""
ComboBox19.Text = ""
ComboBox20.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox21.Text = ""
ComboBox22.Text = ""
ComboBox23.Text = ""
ComboBox24.Text = ""

ActiveWorkbook.Save
MsgBox "Tüm Şeçimleriniz Kaydedilmiştir.", , "Başlık"

End Sub
 
Go to komutunu arastirin.
 
Geri
Üst