Thread: number to name
View Single Post
  #4   Report Post  
JulieD
 
Posts: n/a
Default

Hi Jim

as Bob has not coded an "end sub" prior to the error handler, the code under
the error handler runs in all circumstances.

if you turn application.enableevents off you need to turn them back on as it
does not happen automatically ever.

Cheers
JulieD


"Jim May" wrote in message
news:xSMKd.53244$jn.37047@lakeread06...
Bob,
Side question..
I notice that
Application.EnableEvents = True << only appears under ws_exit:
and not elsewhere,
This says to me that ONLY if there is an error does the status of
EnableEvents
get "turned-back" to "On", or TRUE;
Is this because EnableEvents whenever set to False, defaults back to True
on
successful
completion of any/all SUB(s)?
TIA,
Jim May


"Bob Phillips" wrote in message
...
Bart,

Using event code you can do it

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B2:H10")) Is Nothing Then
With Target
Select Case .Value
Case 1: .Value = "Mark"
Case 2: .Value = "John"
Case 3: .Value = "Bill"
End Select
End With
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.

Extend the list as far as you want.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"bart" wrote in message
...
I want to do my schedule with Excell, and I was wondering if it's

possible
to
type a number and get a name instead... for example if on the 3rd of
february, Mark is working, and that I associate the number 1 to Mark.
is
there a way that if I type "1" under the 3rd of february, that converts

it
directly to Mark?
thanks
Gaetan