Passing Multiline textbox to one cell

rustym

New Member
Joined
Jul 22, 2010
Messages
18
Hi guys,
I am using a userform which has a textbox which I have set to multiline so that the user can enter several lines of text all in the same textbox. This text then needs to be copied to a cell in Excel. My problem is that when I do this the carriage return squares appear at the end of every line (and since I am printing this page I don't want them there).

I have tried the replace method and the split to get rid of the squares but they haven't worked. Does anyone have any ideas on how to get around this?

Thank you all in advance.

rustym
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try like this

Code:
Private Sub CommandButton1_Click()
With Range("A1")
    .WrapText = True
    .Value = TextBox1.Text
End With
End Sub
 
Upvote 0
Thanks for the reply VoG. However, I tried your code but I am still getting those squares. Any other ideas?
 
Last edited:
Upvote 0
Try changing
Code:
.Value = TextBox1.Text
to
Code:
.Value = Replace(TextBox1.Text, vbCr, "")
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,021
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top