|
-
Nov 5th, 2009, 08:16 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Multiline textbox
Suppose you populate two cells:
Range("A1").text = "This is the first line"
Range("A2").text = "This is the second line"
Then you have a textbox and you set the multiline property to true. How can you fill the textbox so that you see both cells in two separate lines like:
This is the first line
This is the second line
-
Nov 5th, 2009, 08:32 PM
#2
Re: Multiline textbox
Code:
Textbox1.Text = Range("A1").Value & Chr(10) & Range("A2").Value
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Nov 6th, 2009, 12:11 PM
#3
Addicted Member
Re: Multiline textbox
Hi,
Not to tread on any toes koolsid, but that will not work. A new line in Windows needs both CR and LF and your code only puts LF.
Using vbCrLf solves all! 
Code:
Textbox1.Text = Range("A1").Value & vbCrLf & Range("A2").Value
or of course you could also use:
Code:
Textbox1.Text = Range("A1").Value & Chr(13) & Chr(10) & Range("A2").Value
Cheers.
-EM
---
REMEMBER: If your issue is resolved, use the Thread Tools menu to set it as such, and be sure to rate the posts that help you the most!

Just because I was jealous of g4hsean! 
-
Nov 6th, 2009, 12:34 PM
#4
Re: Multiline textbox
Or you could use
Code:
TextBox1.Text = Range("A1").Value & vbNewLine & Range("A2").Value
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|