• DİKKAT

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

textbox toplam işlemi hata

textbox14 kadar tüm toplama yapıp texbox15 sonuç
texbax15/texbox16=texbox20 vermesini istiyorum ama yapamadım
 
Çıkış kodlarının tümüne aşağıdaki gib if şartını ekleyin.
Kod:
Private Sub textbox1_exit(ByVal cancel As MSForms.ReturnBoolean)
    If TextBox1.Text <> "" Then
        TextBox1.Text = FormatCurrency(TextBox1.Text)
    End If
End Sub




CommandButton1_Click kodlarını aşağıdakilerle değiştin.
Kod:
Private Sub CommandButton1_Click()
    Dim i As Byte, topla As Double
    For i = 1 To 14
        If Controls("TextBox" & i) <> "" Then
            topla = topla + Controls("TextBox" & i)
        End If
    Next i
    TextBox15.Text = FormatCurrency(topla)
    
    With Worksheets("rapor")
        For i = 1 To 14
            .Cells(i + 10, 9) = Controls("TextBox" & i)
        Next i
    End With
    
End Sub
 
teşekkür ederim toplama işlemi oldu elinize sağlık.
texbax15/texbox16=texbox20 nasıl yapabilirim
 
CommandButton1_Click kodlarını aşağıdakilerle değiştin.
Kod:
Private Sub CommandButton1_Click()

    Dim i As Byte, topla As Double
    For i = 1 To 14
        If Controls("TextBox" & i) <> "" Then
            topla = topla + Controls("TextBox" & i)
        End If
    Next i
    TextBox15.Text = FormatCurrency(topla)
   
    For i = 1 To 14
        Worksheets("rapor").Cells(i + 10, 9) = Controls("TextBox" & i)
    Next i
   
    Hesapla
   
End Sub



İlave kodlar:
Kod:
Private Sub textbox16_exit(ByVal cancel As MSForms.ReturnBoolean)
    If TextBox16.Text <> "" Then
        TextBox16.Text = FormatCurrency(TextBox16.Text)
    End If
    Hesapla
End Sub

Private Sub Hesapla()
    Dim a, b
    a = TextBox15.Text
    b = TextBox16.Text
    If a = "" Then a = 0
    If b = "" Then b = 0
   
    If b = 0 Then
        TextBox20.Text = FormatCurrency(0)
    Else
        TextBox20.Text = FormatCurrency(a / b)
    End If
End Sub
 
teşekkür ederim. emeğinize sağlık
 
Geri
Üst