+ Reply to Thread
Results 1 to 8 of 8

Type in TextBox after referencing a different Textbox

  1. #1
    Registered User
    Join Date
    05-30-2014
    Posts
    3

    Type in TextBox after referencing a different Textbox

    I am having a problem on a UserForm that I am unable to solve.

    TextBox 1 = 04/29
    Textbox 2 needs to be 04/29 + whatever is typed.

    If you do the code TextBox1.Value = Textbox2.Value, TextBox2 will show the value of TextBox1. However,TextBox2 will not allow you to type anything additional.

    How do you get Textbox 2 to pick up the value of TextBox1 and allow you to type additional information?
    Last edited by WAYNE005; 06-05-2014 at 06:56 PM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Type in TextBox after referencing a different Textbox

    TextBox2 will absolutely allow you to type something additional, unless TextBox2 has Enabled=FALSE. Can you attach your file?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    05-30-2014
    Posts
    3

    Re: Type in TextBox after referencing a different Textbox

    6StringJazzer - Thanks for your help with this.

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

    Please Login or Register  to view this content.
    TxtFollowUp1 will pick up th etext from TxtCallDetail.Text. However, it will not allow you type in the textbox after the data it picks up. For example if it picks up 06/29, the textbox will not allow you to place text after 06/29.

    All textboxes are enabled to true

    I've solved everything else on the UserForm but this.
    Attached Files Attached Files
    Last edited by 6StringJazzer; 06-03-2014 at 06:28 PM.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Type in TextBox after referencing a different Textbox

    Here is your problem. The line of code that you quote above is in TxtFollowUp1_Change. This Sub is executed whenever the content of TxtFollowUp1 changes. As soon as that happens, you are replacing its contents with whatever is in TxtCallDetail. So the moment that the user types one character into TxtFollowUp1, it is replaced by whatever is in TxtCallDetail. Therefore you will never be able to type anything into TxtFollowUp1.

    Because I don't know what you intend to do here, I can't fix it for you. If you describe the behavior you want I can help further. My wild guess would be that this should be renamed Sub TxtCallDetail_Change.

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Type in TextBox after referencing a different Textbox

    Hello WAYNE005,

    To use the Call Detail as prefix in the text box "txtFollowup1" you need to use the Enter event and not the Change event. I have made the change to the attached workbook.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Type in TextBox after referencing a different Textbox

    Leith, won't that still wipe out whatever the user types into TxtFollowUp1 and replace it with the content of TxtCallDetail? My impression is that he wants to initialize TxtFollowUp1 with whatever is typed into TxtCallDetail, then allow the user to append to it.

  7. #7
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Type in TextBox after referencing a different Textbox

    Perhaps code like this would do what you want, assuming that the + in the OP indicated concatenation rather than addition. This approach could be adapted to numeric addition.
    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  8. #8
    Registered User
    Join Date
    05-30-2014
    Posts
    3

    Re: Type in TextBox after referencing a different Textbox

    Thank you very much Mike! Your solution worked perfectly.

+ 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. Userform to search textbox value to place other textbox values in worksheet
    By mattyh555 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2012, 11:38 AM
  2. Replies: 3
    Last Post: 05-07-2012, 09:46 PM
  3. Convert text in textbox as i type
    By pblnrao in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-22-2011, 03:37 AM
  4. Textbox Content Type
    By KingG in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-12-2006, 10:30 AM

Tags for this Thread

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