+ Reply to Thread
Results 1 to 18 of 18

How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

  1. #1
    Registered User
    Join Date
    08-05-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    53

    How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    Hello again,

    I have designed a userform that populates a spreadsheet.

    My form uses text boxes which I have set to allow the enter key and multi line formatting (for addresses or paragraphs of text).
    My text box, for example, is called txtAddress and this text box populates cells Q9:Q999 on my spreadsheet.

    I have seen answers with a few lines of code but I don't know how to adapt the code or where to put it. Does it go in the cells or in the coding of the userform somewhere?

    Can somebody help with the example given?

    Thanks,
    Stu

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    Stu

    How are you currently putting the data from the userform on the worksheet?

    Do you still want to display the data in multiple lines as it was on the form?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    08-05-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    Yes. I would like fo rthe cell to reflect the layout from within the userform text box. So this in the text box:

    address line 1
    address line 2
    address line 3

    will be replicated in the cell it populates.

    I currently have something like this in my userform code:

    ActiveCell.Offset(0, 3) = txtLocation.Value
    ActiveCell.Offset(0, 5) = txtReference.Value
    ActiveCell.Offset(0, 11) = txtComments.Value

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    Try setting word wrap on in the cells were the multiline data is going.

  5. #5
    Registered User
    Join Date
    08-05-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    I have done that. But I still get the small rectangle with a question mark inside at the end of every line in the cell.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    I can't replicate that, whatever I try.

    Can you attach a sample workbook?

  7. #7
    Registered User
    Join Date
    08-05-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    Thanks Norie,

    Actually, I just did this in Excel 2010 at home and it works. The problem is at work on Excel 2003 where this doesn't work. I use the same settings but the symbol appears.
    Why is this and how do I get rid?

    Stu

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    Stu

    Long time since I used 2003 but I'm pretty sure that turning on word wrap worked there too.

    How exactly were you trying it in 2003? Where/when in the code did you turn on word wrap?

  9. #9
    Registered User
    Join Date
    08-05-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    In the userform I highlighted the text box, set to 'true' the 'enter key behaviour' and the 'multi line' option.
    In the data cells of the spreadsheet I highlighted the relevant cells/ column and in format cells I checked 'word wrap'.

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    Did you try setting word wrap using code?
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    08-05-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    I can try tomorrow. Where exactly do I put the code?

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    It would go where the code you already have for putting the data on the worksheet is.

    For example.
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    08-05-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    Doesn't work.

    Here is an excerpt from my user form to make sure I got it right:

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    08-05-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    I also just found this but don't know where to put it:
    Please Login or Register  to view this content.
    Would I change A1 to suit my range in column Q (Q5:Q999)?

    Stu

  15. #15
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    Stu

    That's a worksheet formula, it could be converted to VBA but if you want to keep the data on multilines I'm not sure it's a good idea.

    Could you upload a sample workbook?

  16. #16
    Registered User
    Join Date
    08-05-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    I can only upload from home. At work at moment. I would prefer a VBA code to put into the userform side of things.

    Will upload later. Thanks
    Stu

  17. #17
    Registered User
    Join Date
    08-05-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    I have sent the file to my home email address to upload it here. The thing is it works because I have the latest version of Excel. I can only replicate the problem in the Excel version at work. It is 2003 I think, maybe 2007.

    I may sent the file anyway in case you can still help.

  18. #18
    Registered User
    Join Date
    08-05-2012
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    53

    Re: How Do I Remove The Carriage Return Symbol From Cell Populated By A UserForm TextBox?

    Here is what I am working on. As I say, it works in the latest version but not in the earlier version I am using.
    I am going out of my mind trying to find a fix to this!!
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1