+ Reply to Thread
Results 1 to 12 of 12

How can I populate the 8th character of a TextBox??

  1. #1
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    How can I populate the 8th character of a TextBox??

    Hi all,

    How can I add the contents of of Combobox7 (which contains the letter "T") to the 8th position/character
    of TextBox 5??

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: How can I populate the 8th character of a TextBox??

    change the red part to combobox7 or any other source

    Please Login or Register  to view this content.
    Kind regards
    Leo

  3. #3
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: How can I populate the 8th character of a TextBox??

    So it would look like this-



    Please Login or Register  to view this content.
    Last edited by bralew; 10-20-2016 at 06:39 AM.

  4. #4
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: How can I populate the 8th character of a TextBox??

    Thanks, where would I paste this? under-

    Private Sub ComboBox7_Change()

  5. #5
    Forum Contributor
    Join Date
    09-03-2015
    Location
    IE
    MS-Off Ver
    2003 - 2016
    Posts
    258

    Re: How can I populate the 8th character of a TextBox??

    A more direct way is to use a much under utilised feature of the MID() function. Instead of 'cutting' from a starting position as it is usually used, you can 'stuff' into the string as well...

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: How can I populate the 8th character of a TextBox??

    Hi, I get this?
    Attached Images Attached Images
    Last edited by bralew; 10-20-2016 at 07:00 AM.

  7. #7
    Forum Contributor
    Join Date
    09-03-2015
    Location
    IE
    MS-Off Ver
    2003 - 2016
    Posts
    258

    Re: How can I populate the 8th character of a TextBox??

    My apologies, I misread. That feature can only be used to replace a fixed number of characters with the same number of characters. So you cannot replace from position 8 with a length of 1 and then specify more than 1 character as the replacement. If you say from position 8 with a length of 8, then the original string must be longer than 16 characters total or your replacement gets truncated. This will not change the length of the original string.

  8. #8
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: How can I populate the 8th character of a TextBox??

    Hi,

    I was kindly given this code by Leo Taxi but cannot get it to run. Any ideas?


    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: How can I populate the 8th character of a TextBox??

    maybe change

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    Else
    Excel File


    Cheers
    Leo

  10. #10
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: How can I populate the 8th character of a TextBox??

    Or
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: How can I populate the 8th character of a TextBox??

    thanks chaps, I'm in the office now, I'll give it a whirl and get back to you. Cheers

  12. #12
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: How can I populate the 8th character of a TextBox??

    Thank You, it worked brilliantly!!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] If Statements in Userform TextBox to populate other textbox
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-06-2016, 06:57 AM
  2. Populate TextBox from Module prior to opening TextBox
    By Dabbler39 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-05-2013, 05:50 PM
  3. Replacing a character in a textbox
    By CobraLAD in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2010, 07:46 AM
  4. Counting character in textbox in userform
    By Gert-Jan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-20-2006, 07:50 AM
  5. [SOLVED] set cursor position to the last character of textbox
    By hapt285 in forum Excel General
    Replies: 0
    Last Post: 03-30-2006, 07:25 AM
  6. [SOLVED] limit character in textbox
    By Steph in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-06-2005, 05:05 PM

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