Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50090

Copying Text from an Inserted Text Box

$
0
0
I'm a VBA newbie, so please bear with me.

I would like to have non-Excel users working with my "Form" to select and enter text in an inserted text box (not the user control text box). When they click away, have tha row resize automatically to fit. If this can be done in VBA, so much the better, but as a workaround, I can use formulas to resize that row if I can get the text to copy from the text box to a cell or cells. Ideally, the copied text would fit in a single cell and preserve its line formatting. So far, I've only been able to get a macro to paste each line into a separate cell. I can work with this using the CONCATENATE function and autosizing the row with the joined text. Just need a way to select the text in the text box, as my macro selects the text box, but doesn't copy the contents to the clipboard. Thanks for your help. Here's my macro:
Code:

Sub TextBoxRowHeight()
'
' TextBoxRowHeight Macro
'
' Keyboard Shortcut: Ctrl+Shift+V
'
    ActiveSheet.Shapes.Range(Array("TextBox 17")).Select
    Range("AJ63").Select
    ActiveSheet.Paste
    Range("AD63").Select
    Selection.Rows.Autofit
End Sub


Viewing all articles
Browse latest Browse all 50090

Trending Articles