+ Reply to Thread
Results 1 to 6 of 6

TextBox4.SetFocus Not Working

  1. #1
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    TextBox4.SetFocus Not Working

    .
    Have I missed something regarding setting focus to a textbox ? The Command Me.TextBox1.SetFocus works in another part of my project (on UserForm1)
    but it is not working on UserForm2 ... Me.TextBox4.SetFocus.

    Any ideas ?


    Please Login or Register  to view this content.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: TextBox4.SetFocus Not Working

    .
    Been messing around with the macro.

    If I don't run the query ... but simply place the command Me.TextBox4.SetFocus into its own macro, it works.

    So what is happening with the TextBox1 query part of the macro that is causing the SetFocus to fail ?

  3. #3
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: TextBox4.SetFocus Not Working

    Hi Logit,

    This is a bit vague, since many other factors may be at play in the remainder of your Code. Taking a long shot here, have you tried "Activate" instead of "SetFocus"?
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: TextBox4.SetFocus Not Working

    .
    Yup.

    Look at the attached.

    Also a second issue ... after running the query in UserForm2, I'd like the sheet to auto-scroll to the found row. Having difficulty getting it to do that as well.

    Thanks Winon.
    Attached Files Attached Files

  5. #5
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: TextBox4.SetFocus Not Working

    .
    Finally located the issue with SetFocus to the desired TextBox.

    TextBox3 was corrupted somehow. I deleted it from the UserForm and created a new textbox named TextBox3. The SetFocus now functions as desired.


    I am still looking for a solution to have the sheet auto-scroll to the highlighted row where the query term is located - once it is found.

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: TextBox4.SetFocus Not Working

    .
    HA ! For the inquiring minds out there ... I found that answer as well.

    Please Login or Register  to view this content.
    This thread is now solved !

    Thanks everybody !!

+ 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] .setfocus on userform not working
    By janderson055 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-15-2017, 03:22 PM
  2. [SOLVED] Setfocus is not working after find.
    By OM1950 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-10-2014, 06:33 PM
  3. Setfocus not working
    By Cbrehm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2011, 02:55 PM
  4. SetFocus Method Not working
    By lethal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-07-2010, 02:59 AM
  5. .SetFocus Not working properly
    By Tirren in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-16-2008, 05:26 PM
  6. trying to SetFocus not working
    By bhofsetz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-14-2008, 05:50 PM
  7. TextBox.SetFocus not working
    By vesoljc in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-11-2007, 01:49 AM
  8. SetFocus not working
    By Henry T in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-15-2005, 01: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