FIXED TEXT AFTER DELETION

Q

Qull666

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.
 
J

Jim Cone

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




"[email protected]"
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.
 
Q

Qull666

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!
 
J

Jim Cone

"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


"[email protected]"
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!
 
Top