Reference a textbox in a formula that fills a different textbox

  • I have a textbox that I want to fill with a formula that references another text box on the same userform.
    This is what I have... but I want to have the number 11 be a variable so when I type in a value in Textbox1 then the formula will put the value of textbox1 in for the number "11"


    Code
    Private Sub CommandButton5_Click()
    TextBox2.Value = Evaluate("(11-(2*1.33))*2")
    End Sub


    Thanks

  • Re: Reference a textbox in a formula that fills a different textbox


    Welcome to Ozgrid.


    Please learn to use code tags, which are required when posting VBA code.
    I've added them for you this time.


    Code
    Private Sub CommandButton5_Click()
    TextBox2.Value = Evaluate(TextBox1.Value - (2 * 1.33)) * 2
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!