Text shape workaround with spaces

mahmed1

Well-known Member
Joined
Mar 28, 2009
Messages
2,302
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi All

I have a user form that allows users to enter some text in there...I have allowed the agents to press the enter key to go a new line for readability....
Once they have entered the text. The press save and it gets stored into a cell with no extra spacing and the way i want it to look.

I have a shape in my excel linked to this cell the text is in. The problem i am having is that Excel puts a massive space in between each line and i can only fit in 5 lines before it all gets hidden ( i dont want to resize my shape)

If i enter the text without pressing enter and it wraps around a few lines. The correct spacing gets applied to the shape text.

So what im trying to do is allow the user to press enter in the userform text box but when it gets linked to the shape text - remove that extra space so as if i pressed no enter key but excel still shows a new line but without extra space

I hope im making sense
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try this method to remove the offending characters

VBA Code:
Dim t As String
t = TextBox1.Text
MsgBox t
t = Replace(Replace(TextBox1.Text, Chr(10), ""), Chr(13), "")
MsgBox t
 
Upvote 0
That didn’t work 100% for some reason but if if removed all char(10) with say an * and then replaced the * with char(10)
That worked

dont know why
 
Upvote 0
Hopefully someone can explain this weird behaviour:)
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top