Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default From VBA-GUI textbox to cells

I need to move textlines from a textbox (NB!pasted by the user)on a
VBA-GUI into several cells on a excell sheet.
The problem is that all the text from the textbox ends up in one cell,
and not as it is supposed to do: one line in textbox should end up in
one cell on the sheet.

I guess, I have to locate line shifts in the text that the user pasted
in the textbox. - but how?

I hope anyone has a solution






------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default From VBA-GUI textbox to cells

go to:
http://www.excel-center.com/mailing/020398h.htm



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default From VBA-GUI textbox to cells

Hard coded line shift are done with Chr(13) & Chr(10) (vbCrLf constant).

Private Sub CommandButton1_Click()
Dim sLine As String
Dim i As Long, j As Long
Dim rw As Long, sChr As String
rw = 10
sLine = UserForm1.TextBox1.Text
j = 0
i = 1
Do While i <= Len(sLine)
sChr = Mid(sLine, i, 1)
If sChr < vbCr Then
sStr = sStr & sChr
Else
Cells(rw + j, 1) = sStr
sStr = ""
j = j + 1
' skip vbLf character
i = i + 1
End If
i = i + 1
Loop
Cells(rw + j, 1) = sStr

End Sub

--
Regards,
Tom Ogilvy



"Scandinavian" wrote in message
...
I need to move textlines from a textbox (NB!pasted by the user)on a
VBA-GUI into several cells on a excell sheet.
The problem is that all the text from the textbox ends up in one cell,
and not as it is supposed to do: one line in textbox should end up in
one cell on the sheet.

I guess, I have to locate line shifts in the text that the user pasted
in the textbox. - but how?

I hope anyone has a solution






------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cutting and Pasting Cells into a shape or textbox Gator Excel Discussion (Misc queries) 4 July 14th 08 08:21 PM
Textbox value insert in two cells kk Excel Discussion (Misc queries) 11 March 17th 08 11:26 PM
Automaticaly update a textbox from filtered cells Panos Excel Discussion (Misc queries) 0 October 2nd 07 12:12 PM
TextBox Properties -- Don't move and size with cells Fred Holmes Excel Programming 1 September 4th 03 10:45 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 10:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"