+ Reply to Thread
Results 1 to 5 of 5

TextBox - Removing Values in Textbox upon click

  1. #1
    Registered User
    Join Date
    05-16-2019
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    54

    TextBox - Removing Values in Textbox upon click

    I have a TextBox which is being used for entering a Username and I figured let's put in an instruction to Enter the Username there:

    Please Login or Register  to view this content.

    However when the User clicks on the button it does not remove 'Enter Username' and so this could cause confusion.
    I tried to enter this in the 'GotFocus' bit but this doesen't work:


    Please Login or Register  to view this content.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,855

    Re: TextBox - Removing Values in Textbox upon click

    Add this line of code: me.requery

    and see if that works for you.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    05-16-2019
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    54

    Re: TextBox - Removing Values in Textbox upon click

    Thank you Alan, I add it before the line of code in GotFocus and it said 'Method or Data Member Not Found'


    (I'm doing this in Excel)
    Last edited by Steve1977; 11-14-2019 at 12:17 PM.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430

    Re: TextBox - Removing Values in Textbox upon click

    How about this trick using 2 textboxes.
    The message is displayed in the lower box and removed once text is entered
    Attached Files Attached Files
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    05-16-2019
    Location
    London, England
    MS-Off Ver
    2016
    Posts
    54

    Re: TextBox - Removing Values in Textbox upon click

    Brilliant stuff, that's exactly what I want it to do, I see there's code in Initialise and Change so will apply that to mine now

    Thank you

+ 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] How to select all text in textbox when i click textbox "userform"
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-14-2017, 11:30 AM
  2. Replies: 5
    Last Post: 05-19-2016, 04:34 AM
  3. [SOLVED] Repeatedly click a cmdButton to populate a TextBox with different cell values
    By LordBucketHead in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-26-2013, 03:22 PM
  4. 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
  5. Replies: 5
    Last Post: 11-18-2010, 05:37 PM
  6. Userform: Pass textbox values to another textbox on button press
    By adjustermn in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2010, 11:19 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