+ Reply to Thread
Results 1 to 10 of 10

Add text instruction to a cell to prompt for input

  1. #1
    Forum Contributor
    Join Date
    10-03-2012
    Location
    USA
    MS-Off Ver
    2010
    Posts
    496

    Add text instruction to a cell to prompt for input

    Hello,
    In A1- A4, I want to have a text prompt (gray color, Arial) in each cell
    to ask the user to enter the information. The text prompt will be replaced
    by the information you entered. Delete the information, the prompt will reappear.

    Cell ......Prompt
    A1 = Enter your name
    A2 = Street number, Street
    A3 = City, State, Zip Code, Country
    A4 = Telephone Number

    I have being using two cells to do this but problematic if there are lots, and it does
    not work for merged cell. What I did is that the cell on the left, I make the column width very narrow, and I place
    a formula, to check the 2nd cell on the right if it is "" or not "". If it is "", then "Enter your name";
    if this not "", then "".

    I use across horizontal alignment on both cells to position the prompt on the 2nd cell. Because
    1st cell is very narrow column width (1), the text appears is belong to the 2nd cell.

    I am looking for a new way using VBA to do this. Cells can be any where other than A1:A4.
    It is better if VBA can be written to allow me to specify the cells to use the code.


    Thanks
    Last edited by Rocky2013; 05-18-2017 at 09:24 PM.

  2. #2
    Forum Expert gmr4evr1's Avatar
    Join Date
    11-24-2014
    Location
    Texas
    MS-Off Ver
    Office 2010 and 2007
    Posts
    3,448

    Re: Add text instruction to a cell to prompt for input

    See if the attached is close to what you are wanting
    Rocky2013 Add text instruction to a cell.xlsm
    Here is the code I used
    Please Login or Register  to view this content.
    1N73LL1G3NC3 15 7H3 4B1L17Y 70 4D4P7 70 CH4NG3 - 573PH3N H4WK1NG
    You don't have to add Rep if I have helped you out (but it would be nice), but please mark the thread as SOLVED if your issue is resolved.

    Tom

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Add text instruction to a cell to prompt for input

    You could use Data Validation, with the formula =TRUE, and set the InputMessage to the text you desire. No VBA is needed.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Forum Expert leelnich's Avatar
    Join Date
    03-20-2017
    Location
    Delaware, USA
    MS-Off Ver
    Office 2016
    Posts
    2,807

    Re: Add text instruction to a cell to prompt for input

    Hi Rocky, I really like your 2-cell trick. If you left-align the column A "prompts", you can indent several times to make the text appear to occupy column B, WITHOUT making column A "skinny" OR needing a formula (prompt only appears if the cell to the right is empty). Would that help?
    NOTE: Make sure word-wrap is OFF in the "prompt" cell.
    Last edited by leelnich; 05-18-2017 at 03:46 PM.

  5. #5
    Forum Contributor
    Join Date
    10-03-2012
    Location
    USA
    MS-Off Ver
    2010
    Posts
    496

    Re: Add text instruction to a cell to prompt for input

    Hello,
    gmr4evr1, I take your code but I change the font color to gray using conditional formating.
    Once the information is entered, it changes the font color to black (default). I pre

    mikerickson, Do not knpw exactly how to setup.

    leelnich, The reason I make the first column width very narrow to 1.0, because I want to make that column
    visual disappear and save the overall sheet width. Besides those 4 prompts but there are more cells with
    various column widths. In some case I have to merge two cells to make up the text width.

    Thanks all.

  6. #6
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    Re: Add text instruction to a cell to prompt for input

    its not the best but try it

    Please Login or Register  to view this content.

  7. #7
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Add text instruction to a cell to prompt for input

    Quote Originally Posted by Rocky2013 View Post
    ...
    mikerickson, Do not knpw exactly how to setup.
    ...
    Look at A1:A4 of the attached.
    Attached Files Attached Files

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Add text instruction to a cell to prompt for input

    Quote Originally Posted by mikerickson View Post
    You could use Data Validation, with the formula =TRUE
    Hi Mike,

    What's the purpose of using =TRUE in the formula of the DV? I not seeing any difference between using =TRUE or not using it, but must be missing something.
    HTH
    Regards, Jeff

  9. #9
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Add text instruction to a cell to prompt for input

    The goal is to get the Input Message, not to validate the entry.
    With =TRUE, Excel will accept anything that the user enters.

    The =TRUE allows us to use the Input Message feature of Data Validation, without being bothered with any data being validated.

    (Kind of a cheap SelectionChange event)

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Add text instruction to a cell to prompt for input

    Okay thanks Mike for the explanation.

+ 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. Prompt user for a cell comment based on input.
    By sam1212 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-11-2014, 06:55 AM
  2. [SOLVED] input prompt if cell is empty
    By Burt_100 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2014, 05:55 PM
  3. VBA Embed Application Input Prompt in a Cell in Excel
    By sanjeevpandey in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-19-2013, 09:08 AM
  4. [SOLVED] Prompt input of future date in cell when another cell has been populated or modified
    By coffeemints in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2013, 06:46 PM
  5. HOW TO: Disappearing instruction text with entered value.
    By simplywillb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-15-2013, 01:34 AM
  6. [SOLVED] Macro to manually input which field (column) to autofilter on using an input prompt
    By rin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2012, 09:35 AM
  7. Having a mcro prompt me for manual input in cell
    By Leon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2006, 03:30 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