Announcement

Collapse
No announcement yet.

Reference a textbox in a formula that fills a different textbox

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Last edited by AAE; April 14th, 2012, 07:40. Reason: add code tags

  • #2
    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
    AAE
    ----------------------------------------------------

    Forum Rules | Message to Cross Posters | How to use Tags

    Comment

    Working...
    X