• DİKKAT

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

EVET/HAYIR sorgusu eklemek istiyorum.

  • Konbuyu başlatan Konbuyu başlatan s.savas
  • Başlangıç tarihi Başlangıç tarihi
Katılım
12 Ocak 2009
Mesajlar
838
Excel Vers. ve Dili
2003
İyi geceler arkadaşlar.
Aşağıdaki koda ek bir koşul eklemek istiyorum.

2.Nöbetçi boş geçildiğinde EVET/HAYIR şeklinde bir soru sorsun. Cevap EVET ise 2.Nöbetçi yazılmadan kaydetme işlemi gerçekleşsin. Cevap HAYIR ise 2. Nöbetçi yazılmadan kaydetme işlemi yapılamasın.

Kod:
If ComboBox1.Value = "" Then
ComboBox1.SetFocus
MsgBox ("Lütfen 1.Nöbetçiyi Giriniz"), vbInformation, "s.s."
Exit Sub
End If

If ComboBox2.Value = "" Then
ComboBox2.SetFocus
MsgBox ("Lütfen 2.Nöbetçiyi Giriniz"), vbInformation, "s.s."
Exit Sub
End If
 
Merhaba,
Kod:
If ComboBox2.Value = "" Then
ComboBox2.SetFocus
Sor = MsgBox("2.Nöbetçi girilmedi; yine de kayıt yapılsın mı?", vbYesNo, "s.s")
If Sor = vbNo Then Exit Sub
End If
 
Merhaba,
Kod:
If ComboBox2.Value = "" Then
ComboBox2.SetFocus
Sor = MsgBox("2.Nöbetçi girilmedi; yine de kayıt yapılsın mı?", vbYesNo, "s.s")
If Sor = vbNo Then Exit Sub
End If

Mustafa hocam ilginize teşekkür ederim.
Aşağıdaki satırda hata mesajı verdi.
Kod:
Private Sub cmdKAYDET_Click()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim satır As Long, k As Byte, s As Worksheet
Set s = ActiveSheet

'If Not FrameTest Then Exit Sub

satır = s.Range("A65536").End(3).Row + 1

If TextBox7.Value = "" Then
TextBox7.SetFocus
MsgBox ("Lütfen Tarih Giriniz"), vbInformation, "s.s."
Exit Sub
End If


If ComboBox1.Value = "" Then
ComboBox1.SetFocus
MsgBox ("Lütfen 1.Nöbetçiyi Giriniz"), vbInformation, "s.s."
Exit Sub
End If

If ComboBox2.Value = "" Then
ComboBox2.SetFocus
[COLOR="Red"][U]Sor = MsgBox("2.Nöbetçi girilmedi; yine de kayıt yapılsın mı?", vbYesNo, "s.s")[/U][/COLOR]
If Sor = vbNo Then Exit Sub
End If

If ComboBox1.Value = ComboBox2.Value Then
ComboBox2.SetFocus
MsgBox ("Her iki nöbetçi aynı kişi olamaz"), vbInformation, "s.s."
Exit Sub
End If

If TextBox6.Value = "" Then
TextBox6.SetFocus
MsgBox ("Lütfen Protokol Numarasını Giriniz"), vbInformation, "s.s."
Exit Sub
End If


If TextBox2.Value = "" Then
TextBox2.SetFocus
MsgBox ("Lütfen Çıkış Km sini Giriniz"), vbInformation, "s.s."
Exit Sub
End If

If TextBox3.Value = "" Then
TextBox3.SetFocus
MsgBox ("Lütfen Dönüş Km sini Giriniz"), vbInformation, "s.s."
Exit Sub
End If



If TextBox3 <> 0 And Val(TextBox3.Text) < Val(TextBox2.Text) Then
MsgBox ("Dönüş Km si Çıkış Km sinden Küçük Olamaz."), vbInformation, "s.s."
TextBox3.SetFocus
Exit Sub
End If

TextBox5.Text = Val(TextBox3) - Val(TextBox2)
s.Cells(satır, "A").Value = TextBox7.Value 'Kayıt Tarihi
s.Cells(satır, "A").HorizontalAlignment = xlCenter
s.Cells(satır, "B").Value = TextBox6.Value 'pROTOKOL
s.Cells(satır, "B").HorizontalAlignment = xlCenter
s.Cells(satır, "C").Value = ComboBox1.Value 'Nöbetçi 1
s.Cells(satır, "D").Value = ComboBox2.Value 'Nöbetçi 2
s.Cells(satır, "BW").Value = TextBox2.Value 'Çıkış Km
s.Cells(satır, "BX").Value = TextBox3.Value 'Dönüş Km
s.Cells(satır, "BZ").Value = TextBox4.Value 'Alınan Yakıt
s.Cells(satır, "BZ").NumberFormat = "#,##0.00"
s.Cells(satır, "BY").Value = CDbl(TextBox5.Text) 'Yapılan Km



If OptionButton1.Value = True Then
s.Cells(satır, "E").Value = "1"
s.Cells(satır, "E").HorizontalAlignment = xlCenter
End If
 
Merhaba,
Ben de hata vermediği için yorum yapamayacağım. Kod bloğunu useform oluşturup denedim; yine de bir sorun yaşamadım.
 
Hocam teşekkür ederim.
Sonradan aklıma geldi ve şu şekilde sorunu çözdüm.
Kod bloğunun başına
Kod:
Dim Sor
ekleyince hata mesajı vermedi.
 
Geri
Üst