+ Reply to Thread
Results 1 to 3 of 3

Insert leading spaces

  1. #1
    Registered User
    Join Date
    04-25-2005
    Posts
    99

    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

  2. #2
    Dave Peterson
    Guest

    Re: 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. #3
    Registered User
    Join Date
    04-25-2005
    Posts
    99
    Dave Peterson - Thanks for the help. That is exactly what I need. It worked perfectly.

    Thanks,

    DejaVu

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1