Consulting

Results 1 to 3 of 3

Thread: Solved: Multi-Line into a cell

  1. #1
    VBAX Tutor Philcjr's Avatar
    Joined
    Jul 2005
    Location
    Bedminster, NJ
    Posts
    208
    Location

    Solved: Multi-Line into a cell

    I am trying to take multiple texboxes and concatinate them into one cell. However, when I do this, I get a "Square" after each value - assuming it is the vbNewLine? How can I get rid of that "Square"?????

    [VBA]
    '------------------------------------------
    Private Sub FinishButton_Click()
    Dim Msg As String, x As Integer
    Dim row As Integer

    Msg = PartNumber1.Value

    For x = 2 To 10
    With Me.Controls("PartNumber" & x)
    If .Value <> "" Then Msg = Msg & vbNewLine & .Value
    End With
    Next x

    row = Worksheets("POs").Range("A1:A65526").Find(POSeries.Value, , , xlWhole).row
    If row = 0 Then Exit Sub

    Range("g" & row).Value = Msg

    End Sub

    [/VBA]
    Thanks,
    Phil

  2. #2
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Use Chr(10) instead of vbNewLine. What you're doing translates into an actual character on the worksheet. Chr(10) - CHAR(10) in a worksheet function - will not show up as the dreaded square. Something like this ..

    [vba]Option Explicit

    Sub ShowNoSquarePlease()
    With ActiveCell
    .Value = "a" & Chr(10) & "b" & Chr(10) & "c"
    End With
    End Sub[/vba]

  3. #3
    VBAX Tutor Philcjr's Avatar
    Joined
    Jul 2005
    Location
    Bedminster, NJ
    Posts
    208
    Location
    The " Char(10) " worked... thanks

Posting Permissions

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