How to link textbox to multiple cells in Excel?
As we all known, it is easy for us to link a textbox to a specific cell, but, is it possible to link multiple cells to the same textbox? So when you click different cells, the textbox will display different texts. May be, this article can solve this task in Excel.
- Reuse Anything: Add the most used or complex formulas, charts and anything else to your favorites, and quickly reuse them in the future.
- More than 20 text features: Extract Number from Text String; Extract or Remove Part of Texts; Convert Numbers and Currencies to English Words.
- Merge Tools: Multiple Workbooks and Sheets into One; Merge Multiple Cells/Rows/Columns Without Losing Data; Merge Duplicate Rows and Sum.
- Split Tools: Split Data into Multiple Sheets Based on Value; One Workbook to Multiple Excel, PDF or CSV Files; One Column to Multiple Columns.
- Paste Skipping Hidden/Filtered Rows; Count And Sum by Background Color; Send Personalized Emails to Multiple Recipients in Bulk.
- Super Filter: Create advanced filter schemes and apply to any sheets; Sort by week, day, frequency and more; Filter by bold, formulas, comment...
- More than 300 powerful features; Works with Office 2007-2019 and 365; Supports all languages; Easy deploying in your enterprise or organization.
To link a textbox to multiple cells, the following VBA code can help you, please do as this:
1. First, insert an ActiveX textbox under the Developer tab.
2. Then right click the sheet tab which contains the textbox you want to use, then choose View Code from the context menu, and in the opened Microsoft Visual Basic for Applications window, copy and paste the following code into the blank Module:
VBA code: link textbox to multiple cells:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Column = 3 Then ActiveSheet.TextBox1.Text = Target End Sub
Note: In the above code, the number 3 indicates the column number which your linked cells locate, and Textbox1 is the textbox name you inserted, please change them to your need.
3. Then save and close this code window, now, when you click different cells, the different values will be displayed into the textbox automatically, see screenshot: