Updating a textbox without erasing previous data

  • Thread starter Thread starter nadir
  • Start date Start date
N

nadir

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.
 
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 said:
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.


------------------------------------------------



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