Link a textbox in excel to a cell with more than 255 characters.
Posted on 2016-08-24
In excel I'd like to link a textbox to a cell that will populate the textbox with more than 255 characters.
Being unfamiliar with VBA, a search turned up a solution offered by Microsoft that I have edited to:
Dim i As Integer
Dim mytxt As String
mytxt = WorksheetFunction.Rept("TableLegend3", 250)
' Initialize text in text box.
.Text = ""
For i = 0 To Int(Len(mytxt) / 255)
.Characters(.Characters.Count + 1).Text = Mid(mytxt, (i * 255) + _
The cell that is intended to populate the textbox is named TableLegend3, is in a different worksheet and contains a formula that determines the text to appear in the text box.
The textbox is named Legend3TextBox and the VBA code is attached to the sheet with the textbox in it.
I've tried using a textbox from the insert menu and receive a Run-time error '1004': Application defined or object-defined error.
I've also tried using an ActiveX control textbox and receive a Run-time error '438': Object doesn't support this property or method.
Any suggestions to fix the existing code or provide a new code are greatly appreciated.