0

I am trying to update the userform TextBox2 "number of cells needed" with the value of C2. The user enters the number of parts in the TextBox1 and it updates the cell value A2, but I cant get it to pass the value of C2 to the other text box automatically. There is a simple formula in C2 =(A2*2)+1 but i dont think that should matter.

Private Sub TextBox1_Change()
ThisWorkbook.Worksheets("Sheet2").Range("A2").Value = TextBox1.Value 
End Sub


Private Sub TextBox2_Change()

TextBox2.txtEcpNum.Text = CStr(Range("C2").Value) 
TextBox2.Show

End Sub

enter image description here

1 Answer 1

3

The Textbox2_Change() event handler is not being called when Textbox1_Change() is being called. All you need to do is change Textbox2 after you change Textbox1, ie. in the same event handler. Namely:

Private Sub TextBox1_Change()

    ThisWorkbook.Worksheets("Sheet2").Range("A2").Value = TextBox1.Value
    TextBox2.txtEcpNum.Text = CStr(Range("C2").Value) 
    TextBox2.Show 

End Sub
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for the help this answered some other questions i was having too. I needed to update multiple handlers elsewhere in my code. Thanks again. I tried to up-vote but i don't have enough reputation yet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.