+ Reply to Thread
Results 1 to 7 of 7

How do you make a text box appear/disappear based on cell content?

  1. #1
    Registered User
    Join Date
    01-31-2015
    Location
    Inverness, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    3

    How do you make a text box appear/disappear based on cell content?

    Hello. This is my first post on here. I have almost no knowledge of VBA programming other than what I have learned whilst trying to research a solution to my problem.

    I have a cell that contains a drop down list of 5 items. I also have 5 text boxes. Depending on which item is selected from the drop down list I would like the corresponding text box to display (and the other 4 to be hidden). i.e. first item in the list is selected then text box 1 will appear, second item in the list is selected then text box 2 will appear and so on.

    How do I achieve this? Also, can this be achieved by using 'normal' text box since the formatting options for activeX text boxes seems to be very limited? Everything is just in a simple worksheet.

    Any help/guidance would be much appreciated!

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: How do you make a text box appear/disappear based on cell content?

    Validation is in cell A2
    Attached Files Attached Files

  3. #3
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: How do you make a text box appear/disappear based on cell content?

    Welcome to the forum! IF you make a short example file and attach it, it is easier to help you the most.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: How do you make a text box appear/disappear based on cell content?

    LoopTextBox.JPG

    Use this code to loop through the textboxes, see attached workbook


    gmac1985.xlsm


    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-31-2015
    Location
    Inverness, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How do you make a text box appear/disappear based on cell content?

    Thank you all for your replies - I really appreciate it! I will try and copy your suggested code into my workbook.

  6. #6
    Registered User
    Join Date
    01-31-2015
    Location
    Inverness, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: How do you make a text box appear/disappear based on cell content?

    Thanks stnkynts, I used the code you suggested and it worked perfectly!

    One other thought...how would I alter the code if the validation cell and the text boxes were in different sheets?
    In my scenario, the text boxes are in a sheet called 'Customer Copy' which was Sheet1 and the validation cell is a drop down list in 'Survey Report' which is Sheet4. I tried just mirroring the cell from Sheet 1 into Sheet 4 by ='Survey Report'!B21 and the used the Sheet1 cell reference in the VBA code. When I made the selection from the drop down list in Sheet4, the mirrored cell in Sheet1 updated correctly but it didn't have an effect on the text boxes.

    Thanks in advance.

  7. #7
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: How do you make a text box appear/disappear based on cell content?

    See attached workbook
    Attached Files Attached Files

+ 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 make radio button appear and disappear based on a cell's value?
    By megtoma in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-05-2014, 12:11 PM
  2. VBA Code to Make a Cell Value Negative Based on Content of Adjacent Cell
    By Court Manager in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-08-2014, 04:18 PM
  3. Change Cell Content to Text based on Cell formatting
    By jmh2008 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-11-2013, 08:51 PM
  4. Replies: 7
    Last Post: 12-27-2012, 10:53 PM
  5. Changing the text on button based on cell content
    By a94andwi in forum Excel General
    Replies: 1
    Last Post: 06-11-2009, 12:58 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