Search code examples
textboxformulauserform

how to return a formula from user form


I am trying to multiply value in Textbox1 X Textbox2 using commandbotton1, so for example if Textbox1 = 3 and TextBox2 = 2.5 I would like to see result in textBox3 as formula including values from TextBox1&2 =3x2.5 i don't want to see result as value 7

Private Sub CommandButton1_Click() Me.TextBox3 = Me.TextBox1 * Me.TextBox2

End Sub


Solution

  • Like this ?

    Private Sub CommandButton1_Click()
      With Me
        .TextBox3.Value = "=" & .TextBox1.Value & " * " & .TextBox2.Value
      End With
    End Sub