Instantly retrieve the TextBox value in an Excel cell
Solved
Hello,
I want to set the value of a textbox in a cell. I'm using the following code:
Sheets("Sheet1").Range("f2").Value = UserForm1.TextBox1.Value
It only works if I exit the user form and click on another cell (I think it's a refresh issue). Is there something missing for the code to work instantly without needing to click on a cell?
Thank you.
I want to set the value of a textbox in a cell. I'm using the following code:
Sheets("Sheet1").Range("f2").Value = UserForm1.TextBox1.Value
It only works if I exit the user form and click on another cell (I think it's a refresh issue). Is there something missing for the code to work instantly without needing to click on a cell?
Thank you.
2 answers
-
Hello,
two possibilities
after changing the textboxPrivate Sub TextBox1_AfterUpdate() Sheets("Feuil1").Range("f2").Value = UserForm1.TextBox1.Value End Sub
on the textbox changePrivate Sub TextBox1_Change() Sheets("Feuil1").Range("f2").Value = UserForm1.TextBox1.Value End Sub -
Thank you very much
it works very well