Cell to Text Box, more than 255 characters

hanman453

New Member
Joined
Jul 8, 2020
Messages
6
Office Version
  1. 2019
Platform
  1. MacOS
Hey guys! I have a dynamically changing cell in my spreadsheet (dependent on the currently selected cell), and I'm trying to have it automatically enter into a Text Box; however, the cell has more than 255 characters typically and when I set the Text Box equal to that cell, only the first 255 characters of the cell show up. How do I solve this issue and get the entirety of the text into the text box?

Thank you so much! It's a great help!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
this might help. see post #6. you might have to register.
here is the code used:
VBA Code:
    ActiveSheet.Shapes.Range(Array("LastIncident1")).Select                          'name of your shape/textbox
    Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = Range("LatestIncidentDesc1").Value           'cell reference you want to get text from
    
  
    'below adjusts formatting
ActiveSheet.Shapes.Range(Array("LastIncident1")).Select
     Selection.ShapeRange.TextFrame2.TextRange.Font.Size = 28
    With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
        .Visible = msoTrue
        .ForeColor.ObjectThemeColor = msoThemeColorBackground1
        .ForeColor.TintAndShade = 0
        .ForeColor.Brightness = 0
        .Transparency = 0
        .Solid
    End With
 
Upvote 0
Thanks so much! I do know how to copy and paste this into the code part of the sheet, but I don't really know how to code myself so I just want to make sure: what parts of this code do I need to change for the name of my sheet, my cell, and/or my text box to make it apply to the right things?
 
Upvote 0
Thanks so much! I do know how to copy and paste this into the code part of the sheet, but I don't really know how to code myself so I just want to make sure: what parts of this code do I need to change for the name of my sheet, my cell, and/or my text box to make it apply to the right things?

I swear I did look it over before replying, but the light green didn't catch my eye. I notice it now—sorry about that! Thank you!
 
Upvote 0
this might help. see post #6. you might have to register.
here is the code used:
VBA Code:
    ActiveSheet.Shapes.Range(Array("LastIncident1")).Select                          'name of your shape/textbox
    Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = Range("LatestIncidentDesc1").Value           'cell reference you want to get text from
   
 
    'below adjusts formatting
ActiveSheet.Shapes.Range(Array("LastIncident1")).Select
     Selection.ShapeRange.TextFrame2.TextRange.Font.Size = 28
    With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
        .Visible = msoTrue
        .ForeColor.ObjectThemeColor = msoThemeColorBackground1
        .ForeColor.TintAndShade = 0
        .ForeColor.Brightness = 0
        .Transparency = 0
        .Solid
    End With

I've tried plugging in this VBA code, but I've come into a couple issues which are totally me and not the code.

Code
I'm figuring what it's saying is that I should replace "LastIncident1" with my Text Box name, say, "Text Box 4" and "LatestIncidentDesc1" with my Cell name, say, "AI5", and that's all I need to do. Is this correct?

Inputting
To input this code, I've been right clicking the sheet, clicking View Code, and pasting it directly underneath the code I already have there. However, this results in an error, because since the code already there ends with "End Sub," it says I shouldn't have anything but comments underneath. How do I input the code properly?

The code that is currently there is:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("AI2").Value = ActiveCell.Address
End Sub

Thank you for your help.
 
Upvote 0
I haven't got the skill level to fix your problem specifically. I do a lot of copying and pasting from others' efforts, but I do know that you cant have spaces in Text Box 4. It has to be TextBox4, probably inside the inverted commas. End Sub has to be at the end, Once. So if you work out how to incorporate this code it has to be pasted above End Sub. That's all I can help with, sorry.
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,618
Members
449,092
Latest member
amyap

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top