Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert leading spaces
I have a userform in which the user inputs *Miles Traveled* into two text boxes -(max & min)-. The miles can be up to 5 characters (99999) in length. If the user, for example, enters "_1_" - "_500_"; I want that to be converted to "_____1_" - "___500_". I want all the leading characters to be spaces. Hopefully this makes sense to someone! TIA DejaVu -- DejaVu ------------------------------------------------------------------------ DejaVu's Profile: http://www.excelforum.com/member.php...o&userid=22629 View this thread: http://www.excelforum.com/showthread...hreadid=499477 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert leading spaces
Something like:
Option Explicit Private Sub CommandButton1_Click() Me.TextBox3.Value _ = Right(Space(5) & CLng(Me.TextBox1.Value), 5) _ & " - " _ & Right(Space(5) & CLng(Me.TextBox1.Value), 5) End Sub DejaVu wrote: I have a userform in which the user inputs *Miles Traveled* into two text boxes -(max & min)-. The miles can be up to 5 characters (99999) in length. If the user, for example, enters "_1_" - "_500_"; I want that to be converted to "_____1_" - "___500_". I want all the leading characters to be spaces. Hopefully this makes sense to someone! TIA DejaVu -- DejaVu ------------------------------------------------------------------------ DejaVu's Profile: http://www.excelforum.com/member.php...o&userid=22629 View this thread: http://www.excelforum.com/showthread...hreadid=499477 -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert leading spaces
Dave Peterson - Thanks for the help. That is exactly what I need. It worked perfectly. Thanks, DejaVu -- DejaVu ------------------------------------------------------------------------ DejaVu's Profile: http://www.excelforum.com/member.php...o&userid=22629 View this thread: http://www.excelforum.com/showthread...hreadid=499477 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do I remove leading spaces and leave the remianing spaces w | Excel Worksheet Functions | |||
Trim Leading Spaces | Excel Worksheet Functions | |||
How do I add leading spaces to a value? | Excel Worksheet Functions | |||
Remove Leading Spaces | Excel Discussion (Misc queries) | |||
Removing leading spaces | Excel Programming |