PDA

View Full Version : Solved: Multi-Line into a cell



Philcjr
10-03-2005, 01:48 PM
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"?????


'------------------------------------------
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


Thanks,
Phil

Zack Barresse
10-03-2005, 01:59 PM
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 ..

Option Explicit

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

Philcjr
10-03-2005, 02:22 PM
The " Char(10) " worked... thanks