user2519726
user2519726

Reputation: 149

VBA: Textbox new/next line

I need some help with my textbox. My Textbox content is being fed by a cell value. Now the construction of the cell value goes like this: "(date comments)" and it happens progressively, i can have multiple entries like that.

Basically i want my textbox to display each value as a single line in the textbox in my user form to make them appear like a bullet list.

is this possible? I'm thinking of detecting each closing parenthesis sign ")" then make it go to next line? but i cannot put my finger on how to actually code it.

Upvotes: 6

Views: 42011

Answers (1)

MatthewD
MatthewD

Reputation: 6801

Set the multiline property of the textbox = true

And you may have to set the ScrollBars property to 2-frmScrollBarsVertical

Then separate the values by a vbCrLf

"somecomment" & vbCrLf & "somecomment" & vbCrLf & "somecomment"

These are the options for newlines depending on what you are doing.

Constant    Equivalent          Description
vbCrLf      Chr(13) + Chr(10)   Carriage return–linefeed combination
vbCr        Chr(13)             Carriage return character
vbLf        Chr(10)             Linefeed character
vbNewLine   Chr(13) + Chr(10)    or, on the Macintosh, Chr(13)  Platform-specific new line character; whichever is appropriate for current platform

Upvotes: 14

Related Questions