Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Userform Textbox value (Excel 2000)

    Hi all,

    I have a textbox within a userform that I would like to display information from a cell. My problem is that I don't want to display all of the information, just a string of characters that I want the pick. If there are 20 characters in the cell, I want to pick the 12th character. and display only 12 to 16, while 1 to 12, and 17 to 20 are not visible.

    Thank you in advance,

    Darryl.

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Userform Textbox value (Excel 2000)

    How about:
    <pre>TextBox1.Value = Mid(Range("A1"), 12, 5)</pre>


    Change the textbox name, and the cell range as desired.

    Steve

  3. #3
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Userform Textbox value (Excel 2000)

    Thanks Steve

    I made it too complicated for myself!

    Question about Mid, what is the difference between Mid and Len?

  4. #4
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Userform Textbox value (Excel 2000)

    LEN gives you the length of a string
    MID gives you a subset of the string. The other parameters are the starting position and the length to extract.

    There are also LEFT and RIGHT which get the left- or right-most characters (you give the number of chars)

    You wanted chars 12-16, so the mid starts at 12 and you get five of them.

    Steve

Posting Permissions

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