Comment help

G

Guest

I am taking the data from a userform to a comment on the cell the is
currently active. I am running into some errors using the following code
close to the end where the data is concantenated. What I need to do is a
carriage return....I thought that might be CHAR(10) within the comments area
so the outcome in the comments area might look something like this:

Customer name:
DOA:
CC#:
EXP Date:
Days Staying:

Current code:

Private Sub Submit_Click()

Dim res As VbMsgBoxResult

If Custname.Text = "" Then
MsgBox "Please enter a valid name!", vbOKOnly
End If

If CCNo.Text = "" Then
res = MsgBox(Prompt:="Do you want to enter a CC for the customer?", _
Buttons:=vbYesNo + vbQuestion)

If res = vbYes Then user.Custinfo.Show
End If


custnm = Custname.Text
dtoa = DOA.Value
CCN = CCNo.Value
ds = DOS.Value
EX = Exp.Value

com = "Customer name: " & custnm & CHAR(10) & "DOA: " & dtoa & CHAR(10) &
"CC#: " & CCN & _
"EXP Date: " & EX & CHAR(10) & "Days Staying: " & ds

End Sub

Thanks in advance!
 
N

Nigel

There are vba constants that you could use. easier to remember that chr
numbers!...

vbCr
vbCrLf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

userform printing 3
Problem without solution yet, 0

Top