- Katılım
- 2 Nisan 2011
- Mesajlar
- 162
- Excel Vers. ve Dili
- office 2007 tr
merhaba textbox1 e comboboxdan 1000 rakam çekiyorum bu çektiğim rakamın üzerine diğer bir textbox2 ye kaç yazarsam 1000 in üzerine okadar rakam eklesini nasıl yapabilirim?
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
UserForm'un içinde şu kodu yazın:
Eğer sadece TextBox1'e yazılmış olan 1000'in üzerine TextBox2'deki değeri eklemek istiyorsanız, aşağıdaki gibi bir işlem yapabilirsiniz:
Private Sub CommandButton1_Click()
Dim sayi1 As Double
Dim sayi2 As Double
Dim toplam As Double
If IsNumeric(TextBox1.Value) And IsNumeric(TextBox2.Value) Then
sayi1 = CDbl(TextBox1.Value)
sayi2 = CDbl(TextBox2.Value)
toplam = sayi1 + sayi2
TextBox1.Value = toplam
MsgBox "Yeni toplam: " & toplam
Else
MsgBox "Lütfen her iki kutuya da geçerli birer sayı girin.", vbExclamation
End If
End Sub
TextBox2'ye girilen değeri alır, 1000 ile toplar ve sonucu TextBox1'e yazar. Ayrıca, TextBox2'ye girilen değerin geçerli bir sayı olup olmadığını kontrol eder ve geçerli değilse bir uyarı mesajı gösterir.
Private Sub CommandButton1_Click()
Dim sabitDeger As Double
Dim sayi2 As Double
Dim toplam As Double
sabitDeger = 1000
sayi2 = Val(TextBox2.Value)
If IsNumeric(TextBox2.Value) Then
toplam = sabitDeger + sayi2
TextBox1.Value = toplam
MsgBox "Yeni toplam: " & toplam
Else
MsgBox "Lütfen TextBox2'ye geçerli bir sayı girin.", vbExclamation
End If
End Sub
Deneyiniz
UserForm'un içinde şu kodu yazın:
Eğer sadece TextBox1'e yazılmış olan 1000'in üzerine TextBox2'deki değeri eklemek istiyorsanız, aşağıdaki gibi bir işlem yapabilirsiniz:
Private Sub CommandButton1_Click()
Dim sayi1 As Double
Dim sayi2 As Double
Dim toplam As Double
If IsNumeric(TextBox1.Value) And IsNumeric(TextBox2.Value) Then
sayi1 = CDbl(TextBox1.Value)
sayi2 = CDbl(TextBox2.Value)
toplam = sayi1 + sayi2
TextBox1.Value = toplam
MsgBox "Yeni toplam: " & toplam
Else
MsgBox "Lütfen her iki kutuya da geçerli birer sayı girin.", vbExclamation
End If
End Sub
TextBox2'ye girilen değeri alır, 1000 ile toplar ve sonucu TextBox1'e yazar. Ayrıca, TextBox2'ye girilen değerin geçerli bir sayı olup olmadığını kontrol eder ve geçerli değilse bir uyarı mesajı gösterir.
Private Sub CommandButton1_Click()
Dim sabitDeger As Double
Dim sayi2 As Double
Dim toplam As Double
sabitDeger = 1000
sayi2 = Val(TextBox2.Value)
If IsNumeric(TextBox2.Value) Then
toplam = sabitDeger + sayi2
TextBox1.Value = toplam
MsgBox "Yeni toplam: " & toplam
Else
MsgBox "Lütfen TextBox2'ye geçerli bir sayı girin.", vbExclamation
End If
End Sub
Deneyiniz