• DİKKAT

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

Textbox boş ise yoksaysın...

Katılım
19 Kasım 2019
Mesajlar
11
Excel Vers. ve Dili
2016 vba
Arkadaşlar merhaba.İki konuda yardmınıza ihtiyacım var.
İlk sorum.
Şöyle bir şey yapmaya çalışıyorum.
Val(TextBox1.Text) * Val(TextBox2.Text)=TextBox3.Value
Val(TextBox4.Text) * Val(TextBox5.Text)=TextBox6.Value
Val(TextBox7.Text) * Val(TextBox8.Text)=TextBox9.Value
Val(TextBox10.Text) * Val(TextBox11.Text)=TextBox12.Value
Val(TextBox13.Text) * Val(TextBox14.Text)=TextBox15.Value
Label1.Caption = TextBox3.Value * TextBox6.Value * TextBox9.Value * TextBox12.Value * TextBox15.Value

Sorun şu , diyelim ki Textbox13 ve textbox14 boş bıraktım.Çarpma olduğu için Textbox15 de "0" oluyor.Haliyle Label1 de "0" oluyor.
Benim şöyle bir kod yazmam lazım. "Eğer Textbox13 ve textbox14 boş ise Textbox13, textbox14 ve textbox15'i görmezden gel.
textbox3,6,9,12 yi çarp ve label1 e yaz.Tam olarak böyle lazım.Başka yöntemler de bulunabilir.Mesela TextBox13,14 boş ise TextBox15="1" olsun gibi.
Ama illa şekilde olması lazım.

İkinci sorum.
UserForm2.hide yapıyorum.Hemen ardından Userform.show yapıyorum.Userform2 tekrar açılana kadar 2 saniye geçmesini istiyorum.
Teşekkür ederim.
 
Merhaba,

Aritmetik işlemlerinden önce if sorguları ile nesneleri yönetebilirsiniz.

Kod:
If TextBox13 = "" And TextBox14 = "" Then TextBox15 = 1

2. sorunuza gelince Wait komutunu kullanabilirsiniz.

Kod:
UserForm2.Hide
Application.Wait Now + TimeValue("00:00:02")
UserForm2.Show
 
Benim şöyle bir kod yazmam lazım. "Eğer Textbox13 ve textbox14 boş ise Textbox13, textbox14 ve textbox15'i görmezden gel.
Boş değilde string değer girilmişse ne yapılacak?
 
Eğer string değer girilmişse vba da hata oluşur

VBA fonksiyonu isnumeric kullanarak bunu önleyebilirsiniz.
Kod:
If not isnumeric(TextBox13)  And not isnumeric(TextBox14) =Then TextBox15 = 1
 
Geri
Üst