Copy Text Box Contents into Rows

  • Thread starter Thread starter caveman.savant
  • Start date Start date
C

caveman.savant

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
 
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?
 
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" <[email protected]> a écrit dans le message de groupe de
discussion : (e-mail address removed)...
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
 
Back
Top