• DİKKAT

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

msgbox ile Textboxlar eşit değil uyarısı

Katılım
18 Mayıs 2009
Mesajlar
166
Excel Vers. ve Dili
Office 2003 Türkçe
Oluşturmak istediğim şarta bağlı bir msg box var lakin onu bile foruma yazmadan yapamıyorum. :) üstadlardan öğrenecek çok şeyimiz var

Yapmaya çalıştığım şey şu üstadlar ;

Textbox1 <> Textbox2 ise Eksik Yada Fazla Satışınız Var uyarısı vererek iki seçenekli msgbox gelsin ve
Eveti seçersem sayfa2'yi seçip yazdırsın
Hayırı seçersem Textbox2 ye giriş yapmam için imleci oraya taşısın
 
Aşağıdaki gibi yapabilirsiniz.

Kod:
if textbox1>textbox2 then
msgbox "Eksik satışınız var."
elseif textbox1<textbox2 then
msgbox "Fazla satışınız var.
textbox2.setfocus
end if
 
Sayın Levent MENTEŞOĞLU

Levent hocam ;
Bu msgbox da "vbYesNo" kodunu kullanma şansımız varmı? Ben aşağıdaki kodu CommandButonlar dan birine atadım ancak vermiş olduğunuz kod şu anlamda işimi görmüyor uyarı mesajını aldığımda (Fazla Satışınız var- Eksik Satışınız var)
buton print etmeye devam ediyor. vbYes No kullanarak Print Seçime bağlı olsa
Yes İle yazdırmaya devametse No ile TextBox ları eşitlemek için TextBox 2 ye mouse imlecini taşısa. mümkünmü?

Kod:
if textbox1>textbox2 then
msgbox "Eksik satışınız var."
elseif textbox1<textbox2 then
msgbox "Fazla satışınız var.
textbox2.setfocus
end if
Sheets("sayfa3").Select
sat = Cells(65536, "C").End(xlUp).Row + 0
Cells(sat, "C").Value = ComboBox1.Value
Sheets("sayfa4").Select
sat = Cells(65536, "C").End(xlUp).Row + 0
Cells(sat, "C").Value = ComboBox2.Value
Sheets("sayfa5").Select
sat = Cells(65536, "C").End(xlUp).Row + 0
Cells(sat, "C").Value = ComboBox3.Value
If ComboBox1.Value = "" Then
MsgBox ("BURASI BOŞ GEÇİLEMEZ")
Exit Sub
End If
If ComboBox2.Value = "" Then
MsgBox ("BURASI BOŞ GEÇİLEMEZ")
Exit Sub
End If
If ComboBox3.Value = "" Then
MsgBox ("BURASI BOŞ GEÇİLEMEZ")
Exit Sub
End If
Sheets("DEKONT").PrintOut , 1
   End Sub
 
Kendi Kendime de çözüm arayışı içindeyken ortaya böyle birşey çıktı fakat bir yerde yanlış yapıyorum.yaptığım şeyin mantığı şu olmalıydı:

Eğer Textbox16 eşitdeğilse Textbox20 msgbox uyarısı vbYesNo şeklinde olsun ve sorsun(Eşitlik yok yinede yazdırayımmı?)
1- Evet diye cevaplarsam ve combobox lar boşdeğilse (ComboBox1,2,3) yazdır.
2- Hayır diye cevaplarsam ve comboboxlar dolu ise(ComboBox1,2,3)Comboboxları boş bırak
3- Eğer eşitlik varsa ve comboboxlar dolu (Combobox1,2,3) ise uyarı vermeden yazdır.

Kod:
Private Sub CommandButton2_Click()
Sheets("sayfa1").Select
If TextBox16 <> TextBox20 Then
iResult = MsgBox("Fazla yada Eksik Satışınız var. Devam etmek istiyormusunuz?", vbYesNo)
End If
If iResult = vbYes Then
    'Evet için buraya kod yazabilirsiniz
    Sheets("sayfa3").Select
sat = Cells(65536, "C").End(xlUp).Row + 0
Cells(sat, "C").Value = ComboBox1.Value
Sheets("sayfa4").Select
sat = Cells(65536, "C").End(xlUp).Row + 0
Cells(sat, "C").Value = ComboBox2.Value
Sheets("sayfa5").Select
sat = Cells(65536, "C").End(xlUp).Row + 0
Cells(sat, "C").Value = ComboBox3.Value
If ComboBox1.Value = "" Then
MsgBox ("PARAYI TESLİM EDECEK KİŞİ DEKONTA YAZILACAĞI İÇİN BOŞ GEÇİLEMEZ")
Exit Sub
End If
If ComboBox2.Value = "" Then
MsgBox ("PARAYI TESLİM ALACAK KİŞİ DEKONTA YAZILACAĞI İÇİN BOŞ GEÇİLEMEZ")
Exit Sub
End If
If ComboBox3.Value = "" Then
MsgBox ("BÖLGE İSMİ DEKONTA YAZILACAĞI İÇİN BOŞ GEÇİLEMEZ")
Exit Sub
End If
Sheets("DEKONT").PrintOut , 1
Else
     'Hayır için buraya kod yazabilirsiniz
    ComboBox1.Value = ""
    ComboBox2.Value = ""
    ComboBox3.Value = ""
    End If
        Sheets("sayfa3").Select
sat = Cells(65536, "C").End(xlUp).Row + 0
Cells(sat, "C").Value = ComboBox1.Value
Sheets("sayfa4").Select
sat = Cells(65536, "C").End(xlUp).Row + 0
Cells(sat, "C").Value = ComboBox2.Value
Sheets("sayfa5").Select
sat = Cells(65536, "C").End(xlUp).Row + 0
Cells(sat, "C").Value = ComboBox3.Value
If ComboBox1.Value = "" Then
MsgBox ("PARAYI TESLİM EDECEK KİŞİ DEKONTA YAZILACAĞI İÇİN BOŞ GEÇİLEMEZ")
Exit Sub
End If
If ComboBox2.Value = "" Then
MsgBox ("PARAYI TESLİM ALACAK KİŞİ DEKONTA YAZILACAĞI İÇİN BOŞ GEÇİLEMEZ")
Exit Sub
End If
If ComboBox3.Value = "" Then
MsgBox ("BÖLGE İSMİ DEKONTA YAZILACAĞI İÇİN BOŞ GEÇİLEMEZ")
Exit Sub
End If
Sheets("DEKONT").PrintOut , 1
    End Sub
 
Geri
Üst