FIXED TEXT AFTER DELETION

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have seen in some excel sheets, when I delete the input, there is a
watermark or meaning the original text is restated. By way of example:

1. Initial display in cell A1: -Please Input Value-
2. And when a value is entered (say) 1000 + enter = 1,000
3. When the value in 2 above is deleted, the original/initial text -Please
Input Value is- is displayed.

How is this done?

Thank you.
 
Excel can create a signal (raise an event) when any cell is changed on a sheet..
Custom code triggered by the event can then determine if a particular cell
is empty and add the message to cell...

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$B$5" Then
If Len(Target.Value) = 0 Then Target.Value = "Enter Something"
End If
End Sub

Right-click a sheet tab and select View Code.
Paste the above code in the module, change cell b5 and see what happens.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware




"(e-mail address removed)"
wrote in message
I have seen in some excel sheets, when I delete the input, there is a
watermark or meaning the original text is restated. By way of example:

1. Initial display in cell A1: -Please Input Value-
2. And when a value is entered (say) 1000 + enter = 1,000
3. When the value in 2 above is deleted, the original/initial text -Please
Input Value is- is displayed.

How is this done?
Thank you.
 
That was awsome. What if there are more than 1 cell, (say) 10 cells
(different locations) or triggered by the one's with boxes/by trigger only,
and range of cells?

Thanks. Much Appreciate It!
 
"Target" is the cell that has been changed.
One can check whether the Target cell is part of a multi-cell range
by using the "Intersect" method in VBA.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"(e-mail address removed)"
wrote in message
That was awsome. What if there are more than 1 cell, (say) 10 cells
(different locations) or triggered by the one's with boxes/by trigger only,
and range of cells?

Thanks. Much Appreciate It!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top