+ Reply to Thread
Results 1 to 9 of 9

TextBox_Enter() Only Fires Once

  1. #1
    Registered User
    Join Date
    03-06-2014
    Location
    Not of this world
    MS-Off Ver
    Excel 2013
    Posts
    37

    TextBox_Enter() Only Fires Once

    Hello, I have stared at this piece of code too long and can't figure out what the problem is. I have two TextBoxes called fileNumberTextBox & appaFileNameTextBox and both get initialized with text when my UserForm is activated. For some reason, the fileNumberTextBox_Enter() sub procedure only fires once.

    I click in the text box, the text disappears as it should, I don't change the text, I click out of the text box and the text repopulates as it should, I then click back in the texbox but the text does not disappear again. However, appaFileNameTextBox_Enter() fires as many times as necessary. Can anyone see an error in the below code? Thank you all in advance for your assistance.

    Edit: I have figured out why fileNumberTextBox only fires once. fileNumberTextBox & appaFileNameTextBox are in different frames on my UserForm. Any ideas on how to use the code below with multiple textboxes in different frames?

    Please Login or Register  to view this content.
    Last edited by nva2k4; 08-11-2016 at 02:13 PM. Reason: Identified Problem

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: TextBox_Enter() Only Fires Once

    Is it actually not firing, or is the If statement being evaluated false, making it look like nothing's happening? If the latter, can you determine why it evaluates false?
    I'm interested in starting a career working with VBA, if anyone knows of any opportunities!

  3. #3
    Registered User
    Join Date
    03-06-2014
    Location
    Not of this world
    MS-Off Ver
    Excel 2013
    Posts
    37

    Re: TextBox_Enter() Only Fires Once

    It's actually not firing. I can never return to that textbox when debugging.

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: TextBox_Enter() Only Fires Once

    Can you post an example workbook that mirrors the issue? I don't see anything after a quick glance in the code, but would like to troubleshoot

  5. #5
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: TextBox_Enter() Only Fires Once

    Your code is all correct and running very fine in my system. May be there remain conflict with other macro or control. So if you can attach the file then I can see that what is going wrong there.

  6. #6
    Registered User
    Join Date
    03-06-2014
    Location
    Not of this world
    MS-Off Ver
    Excel 2013
    Posts
    37

    Re: TextBox_Enter() Only Fires Once

    I just created a test workbook and only kept the two textboxes and relevant code and it works as it should. I'm going to have to keep messing with it and see what I can come up with. I just don't see anything in the rest of my code that would cause the issue.

    Thanks sanram & walruseggman for your help and debugging ideas.
    Last edited by nva2k4; 08-10-2016 at 04:47 PM.

  7. #7
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: TextBox_Enter() Only Fires Once

    You are most welcome. Check your other codes again. May be you have used the fileNumberTextBox there by mistake. Press Ctrl+F and find fileNumberTextBox on other codes. It always feels good to help others.


  8. #8
    Registered User
    Join Date
    03-06-2014
    Location
    Not of this world
    MS-Off Ver
    Excel 2013
    Posts
    37

    Re: TextBox_Enter() Only Fires Once

    Quote Originally Posted by sanram View Post
    You are most welcome. Check your other codes again. May be you have used the fileNumberTextBox there by mistake. Press Ctrl+F and find fileNumberTextBox on other codes. It always feels good to help others.

    Hello sanram. I figured out why fileNumberTextBox only fires once. fileNumberTextBox & appaFileNameTextBox are in separate frames (frame1 & frame2 respectively). I removed both frames from the UserForm and the code I posted in post #1 works as it should. Any ideas on how to work the code when the textboxes are in separate frames?

  9. #9
    Valued Forum Contributor
    Join Date
    06-21-2013
    Location
    Bangladesh
    MS-Off Ver
    Excel 2000, Excel XP, Excel 2002, Excel 2007, Excel 2010, Excel 2013
    Posts
    975

    Re: TextBox_Enter() Only Fires Once

    Yes. There remain problem with focus. When you are selecting a textbox from different frame, then your previous textbox remain focused for corresponding frame. That's why you are facing that problem.

+ 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] Mouse fires SpinButton once, keyboard fires SpinButton twice
    By 79590 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-10-2015, 04:33 PM
  2. Worksheet_Change only fires when worksheet is unprotected
    By rlbush2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-28-2012, 01:36 PM
  3. Each value selected in dropdown fires different macro
    By MarcoAUA in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-11-2012, 04:26 PM
  4. How a textbox_enter can change a SpinButton?
    By marlonsaveri in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-19-2011, 05:00 PM
  5. Sub Fires on Worksheet Close
    By germ in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-21-2010, 02:31 PM
  6. Weekly graph of hires and fires
    By rpernack in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 10-22-2008, 11:44 AM
  7. [SOLVED] code error after autorecover fires
    By Datasort in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2005, 03: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