Userform textbox to multiple rows

jam1531

New Member
Joined
Jan 5, 2015
Messages
29
Hi, This is my first time posting on here. I might be in over my head but I am sure there is someone out there who knows the answer.

I have a userform with a textbox in it. I have the textbox set to multi-line. Whenever I run the macro I've created It will take the input, find the spaces between the words and transpose the information onto an excel spreadsheet.

This works great, however when I copy the information from multiple excel rows and paste directly into the textbox (instead of typing) the output inserts some strange characters into the cells where spaces should be. So instead of pasting three lines of data into three separate rows it places the three lines in every row in the range and places a unkown symbol inbetween each set of data. I have tried some different formulas to fix it, including REPLACE, CHAR and CODE but have had no success.

Here is my code:

Worksheets("Sheet1").Range("<wbr style="color: rgb(46, 62, 63); font-family: Arial;">A1:A4").Value = WorksheetFunction.Transpose(<wbr style="color: rgb(46, 62, 63); font-family: Arial;">Split(TextBox1.Value, " "))


Please let me know what other information is needed to help answer my post.

 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
See if this modification straightens things out for you...

Worksheets("Sheet1").Range("A1:A4").Value = WorksheetFunction.Transpose(Split(Replace(TextBox1.Value, vbLf, " "), " "))
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

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