+ Reply to Thread
Results 1 to 9 of 9

refer to the active userform textbox

  1. #1
    Registered User
    Join Date
    10-22-2017
    Location
    ENGLAND
    MS-Off Ver
    2016
    Posts
    35

    refer to the active userform textbox

    Is there a way to refer to the active textbox in a user form, in a similar way to an active cell e.g. "activecell.value="X" " ?
    Can you do something like activetextbox.value="x" ?
    many thanks

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: refer to the active userform textbox

    May be
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: refer to the active userform textbox

    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  4. #4
    Registered User
    Join Date
    10-22-2017
    Location
    ENGLAND
    MS-Off Ver
    2016
    Posts
    35

    Re: refer to the active userform textbox

    Thanks for the advice sintek , but this returns run time error 13 - type mismatch.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: refer to the active userform textbox

    Can you do something like activetextbox.value="x"
    Perhaps I misunderstood
    Attached Files Attached Files

  6. #6
    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: refer to the active userform textbox

    FYI - The ActiveControl will return the control that is active if the UserForm is the only active container object. If it is not then ActiveControl will return the Active Container on the UserForm which could be a Frame, MultiPage, or WebBrowser and not the control in the container.
    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!)

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: refer to the active userform textbox

    @ Leith...True...I just misunderstood...Assumed OP was referring to Textbox which had focus...
    Is there a way to refer to the active textbox in a user form,

  8. #8
    Registered User
    Join Date
    10-22-2017
    Location
    ENGLAND
    MS-Off Ver
    2016
    Posts
    35

    Re: refer to the active userform textbox

    Dear Leith, Thanks for the file, which works when there is only one text box,
    when i add a second text box, and click on it to place the cursor in it, the command button doesnt put an "x" in it.

    Please Login or Register  to view this content.

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: refer to the active userform textbox

    Perhaps, this is what you want...
    https://www.mrexcel.com/forum/excel-...box-focus.html

+ 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] Updating UserForm TextBox with active row.
    By randall78 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-23-2018, 12:17 PM
  2. Can I refer to a textbox value in userform which has already been Unloaded?
    By VAer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-24-2017, 09:43 AM
  3. [SOLVED] userform to refer to active X check boxes in excel
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-31-2015, 01:10 PM
  4. [SOLVED] Refer to textbox on another UserForm via variable
    By soberguy in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-02-2015, 03:58 PM
  5. [SOLVED] Trying to refer to a textbox in a userform from a module in a for next loop
    By forrestgump1980 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-16-2015, 03:24 PM
  6. Value of Active TextBox in a UserForm
    By j_Southern in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-08-2015, 10:37 AM
  7. VBA, Userform, Textbox: Refer to TextBox Name as a Variable
    By Brianandstewie in forum Excel Programming / VBA / Macros
    Replies: 34
    Last Post: 07-09-2013, 05:49 PM

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