ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Text Box Contents into Rows (https://www.excelbanter.com/excel-programming/434478-copy-text-box-contents-into-rows.html)

caveman.savant

Copy Text Box Contents into Rows
 
I have a Text box that will accept a series of comma separated phases.
By clicking a form button, I'd like to copy those phrases in rows and
a new sheet

Rick Rothstein

Copy Text Box Contents into Rows
 
Where is the TextBox located at... on a UserForm or directly on the
worksheet? If on the worksheet, where did you get the TextBox from... the
Control Toolbox toolbar or the Drawing toolbar? Did you want you code to
create the new sheet before putting the results on it, or does this new
sheet already exist? In either case, what is the name of the sheet to be?
Where on the sheet did you want to start copying to... cell A1 or somewhere
else?

--
Rick (MVP - Excel)


"caveman.savant" wrote in message
...
I have a Text box that will accept a series of comma separated phases.
By clicking a form button, I'd like to copy those phrases in rows and
a new sheet



michdenis

Copy Text Box Contents into Rows
 
Hi,

Try this :

'-----------------------------------
Sub Test()
Dim T As String, S As Variant

'Adapte the name of your sheet
With Worksheets("Sheet1")
'Name of your Shape
T = .Shapes("toto").OLEFormat.Object.Text
End With
'Split() required excel 2000 or a more recent version of excel
S = Split(T, ",")

'Where your phrases will copied
With Worksheets("Sheet2")
.Range("A1").Resize(UBound(S) + 1) = Application.Transpose(S)
End With

End Sub
'-----------------------------------



"caveman.savant" a écrit dans le message de groupe de
discussion : ...
I have a Text box that will accept a series of comma separated phases.
By clicking a form button, I'd like to copy those phrases in rows and
a new sheet



All times are GMT +1. The time now is 09:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com