April 10, 2017

How to add numerical values via text boxes in userform

Adding numerical values in text-boxes on a user-form is not straightforward. Watch the video first and then study the VBA code:

Private Sub CommandButton1_Click()
TextBox3.Value = Val(TextBox1) + Val(TextBox2.Value)
End Sub

One thought on “How to add numerical values via text boxes in userform

  1. Dear Sir,
    i cant able to delete excel data from user form delete option. my all vba is workig properly in active sheet only and inactive sheet i can only data add or update cant able to delete . plz help me.
    im using the code below for dele the data
    Private Sub CommandButton3_Click()
    Dim x As Long
    Dim y As Long
    x = Sheets(“sheet5”).Range(“A” & Rows.Count).End(xlUp).Row
    For y = 2 To x
    If Sheets(“sheet5”).Cells(y, 1).Text = TextBox2.Value Then
    Rows(y).Delete shift:=xlUp
    End If
    Next y
    SUB end

Comments are closed.