View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
DM Unseen DM Unseen is offline
external usenet poster
 
Posts: 233
Default Copying text from regular textbox

You want users to enter text in a textbox which you then paste into
excel on a line by line basis?

(Maybe) use a textbox (from the Controls Toolbox) and link this to a
cell(say A1)

Now enter in a module:

Public Function SplitLines(strVal As String) As String()

SplitLines = Split(strVal, Chr(13) & Chr(10))

End Function

and now select the range where your lines should go and enter in the
formula bar : =TRANSPOSE(splitlines(A1)) and close with
CTRL+SHIFT+ENTER(Array formula!)

The lines shoudl now be visible in the selected range.

Another option would be to use the textbox lostfocus event to trigger
some VBA that does essentially the same (this should also work with
your current textbox).

Dm Unseen