ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Default cell name and value (https://www.excelbanter.com/excel-worksheet-functions/118374-default-cell-name-value.html)

[email protected]

Default cell name and value
 
I'm creating an excel template that I need users to populate. I want
to mark the required input cells as "<enter"; which should equate to
zero.

If users subsequently delete their number, I want the field to default
back to "<enter".

What's the simplest way to do this?

Mike


Bob Phillips

Default cell name and value
 
Put <enter in those cells to begin, and then add

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "G1,H5,K6,L10" '<=== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False
If Not Intersect(Target, rang(WS_RANGE)) Is Nothing Then
If Target.Value = "" Then
Target.Value = "<enter"
End If
End If

ws_exit:
Application.EnableEvents = True
End Sub


This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

wrote in message
oups.com...
I'm creating an excel template that I need users to populate. I want
to mark the required input cells as "<enter"; which should equate to
zero.

If users subsequently delete their number, I want the field to default
back to "<enter".

What's the simplest way to do this?

Mike





All times are GMT +1. The time now is 11:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com