Loading
Ozgrid Excel Help & Best Practices Forums

Excel Video Tutorials / Excel Dashboards Reports



Results 1 to 3 of 3

Thread: Put Grayed Text Into Input Cells for Instructions which Reappears if Input is Deleted

  1. #1
    Join Date
    20th July 2010
    Posts
    41

    Put Grayed Text Into Input Cells for Instructions which Reappears if Input is Deleted

    I would like to have grayed-out text in some cells to give users short instructions for that particular cell. If they type something in that cell, the text they input is in plain dark black...but if they delete what they type, the cell goes back to having the grayed-out text.

    So just for an example, a cell might say ENTER LAST NAME. When the user starts typing in that cell, ENTER LAST NAME disappears and their text shows up in DARK BLACK. BUT if they delete what they typed, ENTER LAST NAME reappears.

    I suppose what I want is conditional formatting which allows me to add text if the cell is empty...but if conditional formatting allows you to 'format' with specific text, I can't find it.

    Does anyone have a suggestion?

    Thank you.

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    22nd February 2011
    Posts
    6

    Re: Put Grayed Text Into Input Cells for Instructions which Reappears if Input is Del

    Insert this into sheet code
    VB:
    Sub RangeSetEmpty() 
        Replace_Blanks [A1:A10], "Enter Last Name" 
    End Sub 
    
    
    Apply the conditonal formats, you can go a step further and adding the above into a worksheet event change to do what you require.

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    19th January 2007
    Location
    South Carolina, USA
    Posts
    9,206

    Re: Put Grayed Text Into Input Cells for Instructions which Reappears if Input is Del

    Adjust range reference to suit.
    Code must go into the worksheet module. Right-click the sheet tab > View Code > Paste in the code > adjust code > close VB Editor

    VB:
    Option Explicit 
     
    Private Sub Worksheet_Change(ByVal Target As Range) 
         
        If Target.Cells.Count > 1 Then Exit Sub 
         
        If Not Intersect(Target, Range("A1:A10")) Is Nothing Then 
            Select Case Target.Value 
            Case Is = "" 
                Target.Value = "Enter Last Name" 
                Target.Font.ColorIndex = 15 
            Case Else 
                Target.Font.ColorIndex = 1 
            End Select 
        End If 
         
    End Sub 
    
    
    AAE
    ----------------------------------------------------

    Forum Rules | Message to Cross Posters | How to use Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Possible Answers

  1. Delete Range if Cells Contain Input Text
    By naaron22 in forum EXCEL HELP
    Replies: 3
    Last Post: November 19th, 2010, 10:01
  2. Input Text In Given Cell After Any Input In An Area
    By cbjorgol in forum EXCEL HELP
    Replies: 11
    Last Post: March 2nd, 2007, 22:10
  3. Insert Vertical Text in Cells based on Textbox Input
    By Steve at work in forum EXCEL HELP
    Replies: 5
    Last Post: July 26th, 2006, 00:57
  4. Text from Cells and Input into html
    By evolart in forum EXCEL HELP
    Replies: 8
    Last Post: October 19th, 2005, 03:25

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
  •  
porno