+ Reply to Thread
Results 1 to 5 of 5

Textbox visible = True based on if textbox has value

  1. #1
    Registered User
    Join Date
    03-23-2019
    Location
    La, USA
    MS-Off Ver
    2016
    Posts
    3

    Textbox visible = True based on if textbox has value

    I have a form with 100+ textboxes and i need the ones that value <> "" to Show. I have added a tag to each one but can not seem to figure it out

    i have a add button if the user needs to add more rows (aka textboxes) so at form start they are set to visible = false. Once the user adds x amount of textboxes and leaves the form the newly added boxes go back into .visible = false state.

    my code as of right now is:

    Please Login or Register  to view this content.
    tried using c.tag = "tb"

    nothing either

    I attached a test copy, userform is loaded with textbox .visible = false
    Control source is Sheet1!D7 , it has text in it
    the textbox .tag is set to .tag = "tb"

    The goal is when the textbox has a value, .visible = true
    referencing the .tag

    would diffidently appreciate any help
    Attached Files Attached Files
    Last edited by mcgrawz; 08-19-2019 at 05:35 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,780

    Re: Textbox visible = false based on if textbox is empty

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. As you are new here, I have done it for you this time.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

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

    Re: Textbox visible = false based on if textbox is empty

    Are all your textboxes named with the term "textBox" ? ie. textBox1, textBox2? Be sure of proper capitalization.
    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

  4. #4
    Registered User
    Join Date
    03-23-2019
    Location
    La, USA
    MS-Off Ver
    2016
    Posts
    3

    Re: Textbox visible = false based on if textbox is empty

    alan - i figured /typename(c) = "textBox"/ referred to class textbox, not the .name. The ideal code would be referring to the .tag "tb" and if .text has a value then visible = true
    if not .visible = false. Not all textboxes need to be referred in the code. Im getting lost at | dim ctl as Control | bring up only .tag & .visible and | MSform.TextBox| bringing up .text & .value.

    or just completely on the wrong path

  5. #5
    Registered User
    Join Date
    03-23-2019
    Location
    La, USA
    MS-Off Ver
    2016
    Posts
    3

    Re: Textbox visible = false based on if textbox is empty

    I attached a test copy, userform is loaded with textbox .visible = false
    Control source is Sheet1!D7 , it has text in it
    the textbox .tag is set to .tag = "tb"

    The goal is when the textbox has a value, .visible = true
    referencing the .tag

+ 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] textbox visibility based on specific text/word of other textbox
    By emmr in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 08-01-2019, 03:28 PM
  2. [SOLVED] Userform textbox value to cell only if textbox not empty
    By Catsonheat in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-26-2019, 09:20 AM
  3. add a string of locked text to vba textbox based on entry in the same textbox
    By yoursamrit2000 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-21-2014, 11:48 PM
  4. [SOLVED] Checking for empty textbox and setfocus the empty textbox
    By subbby in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-23-2013, 02:49 PM
  5. [SOLVED] How to make textbox visible true/false
    By fremarco in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-08-2012, 11:40 PM
  6. Check Or Verify if VISIBLE textbox are empty
    By Zihao123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-24-2012, 03:31 AM
  7. If TextBox has value set visible other TextBoxes, if not set false
    By john55 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-02-2011, 02:53 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