View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default Updating a textbox without erasing previous data

Of course.
Worksheets("result").Newdatabox.Text = "here is the text"
says "this is your text", not "keep your existing text and add the following". Try instead

Worksheets("result").Newdatabox.Text = _
Worksheets("result").Newdatabox.Text & "here is the text" + Chr(10)

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"nadir" wrote in message
...

Hi all,

I have a multiline textbox...
I've built a loop to write many lines; here is it:

For x = 1 To 5
Worksheets("result").Newdatabox.Text = "here is the text" + Chr(10)

Next x

So as to obtain in the textbox something like:
here is the text
here is the text
here is the text
here is the text
here is the text


However, the problem is that at every loop (1 to 5), it seems that it
erases the previous line! And so the only thing I get is:
here is the text
and that's all!..

How can I use a loop to put text (imported from a range of cell
values...) and update my textbox without erasing previous data?

Thanks a lot for your help!
Cheers.


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

~~Now Available: Financial Statements.xls, a step by step guide to creating financial

statements