Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I remove leading spaces and leave the remianing spaces w Debi Excel Worksheet Functions 6 February 28th 07 03:29 PM
Trim Leading Spaces Steven Excel Worksheet Functions 6 February 21st 07 11:21 PM
How do I add leading spaces to a value? Chris Brown Excel Worksheet Functions 3 March 3rd 06 05:23 PM
Remove Leading Spaces Kirk P. Excel Discussion (Misc queries) 3 March 3rd 05 01:30 PM
Removing leading spaces jmdaniel Excel Programming 3 November 3rd 04 08:53 PM


All times are GMT +1. The time now is 08:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"