Hello All!
I hope this message finds you well and that you are able to assist me. I am attempting to link the contents of one text box to another text box in excel - to be clear, I don't want to link the contents of a cell to another text box, and I purposefully would like to do it using VBA because I have never used VBA and would like to learn how to.
I have found this answer on StackOverflow and would appreciate it if anyone could guide me through doing this on excel as I have never used VBA before.
Thank you all!
https://stackoverflow.com/questions...he-textbox-in-other-textboxes-on-other-sheets
Create a module, and place this code there. This needs to be configured for your own specific textbox names and sheet names
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Public Sub UpdateTextBoxes(str As String)
Sheets("sheet1").TextBox1.Text = str
Sheets("sheet2").TextBox1.Text = str
Sheets("sheet3").TextBox1.Text = str
End Sub</code>Then for each textbox object you wish to replicate, use this for its change event (Sheet Class Module) (Change the paramaters to suite your needs)
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Private Sub TextBox1_Change()
UpdateTextBoxes Me.TextBox1.Text
End Sub</code>This way you can name your controls however you see fit, and you can update the text from any of the textboxes, and they will always be consistant.
I hope this message finds you well and that you are able to assist me. I am attempting to link the contents of one text box to another text box in excel - to be clear, I don't want to link the contents of a cell to another text box, and I purposefully would like to do it using VBA because I have never used VBA and would like to learn how to.
I have found this answer on StackOverflow and would appreciate it if anyone could guide me through doing this on excel as I have never used VBA before.
Thank you all!
https://stackoverflow.com/questions...he-textbox-in-other-textboxes-on-other-sheets
Create a module, and place this code there. This needs to be configured for your own specific textbox names and sheet names
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Public Sub UpdateTextBoxes(str As String)
Sheets("sheet1").TextBox1.Text = str
Sheets("sheet2").TextBox1.Text = str
Sheets("sheet3").TextBox1.Text = str
End Sub</code>Then for each textbox object you wish to replicate, use this for its change event (Sheet Class Module) (Change the paramaters to suite your needs)
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Private Sub TextBox1_Change()
UpdateTextBoxes Me.TextBox1.Text
End Sub</code>This way you can name your controls however you see fit, and you can update the text from any of the textboxes, and they will always be consistant.