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
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)
> 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
[quoted text clipped - 6 lines]
>
> Mike