• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

userform textbox value from cell

it's bothers me that code

Code:
Private Sub TextBox9_Change()
TextBox9.Value = Sheets("sheet1").Range("O21").Value
End Sub

i made a userform with calculation but in one textbox (textbox9)
i wanted to bring the value of a cell (o21)
with the code i manage to do it but when i run the userform it doesn't show the value of o21 except if i write something for example if i navigate to textbox9 and write 0 the it doesn't write 0 but it brings the value of cell o21.
is a way to do what i want but it's not the perfect solution

i hope it is understanding my message and to give me a solution as always you do
thanks at advance
 
Last edited by a moderator:
Use
Code:
Private Sub TextBox9_Enter()
TextBox9.Value = Sheets("sheet1").Range("O21").Value
End Sub
or
Code:
Private Sub UserForm_Initialize()
TextBox9.Value = Sheets("sheet1").Range("O21").Value
End Sub
 
Back
Top