Enter Male / Female only into cell.

D

DarrenPWS

It's me again,

You are all so efficient with your answers, I thought I would tak
advantage of you...

How can I ensure that only the words "Male/male/Female/female" ar
entered into a "gender" cell?

Thanks again
 
D

DarrenPWS

Hi

I would use a list, but because I am working on a college project I
must stick to the specification. Is there a way to ensure that only
Male/male/Female/female can be typed in?

Also :

In one field there are 4 types of data entered. There are only 20 rows
within this field, so it's not too large - What I would like to know is
how to create a small table elsewhere on the sheet that will display a
quantity for each of the 4 types of data.

The types are : OAP / U12 / Adult / 12 - 18 yrs.

Thanks for your help.
 
J

JE McGimpsey

one way:

Put this macro in the worksheet code module (right-click the worksheet
tab and choose view code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Target, Range("gender")) Is Nothing Then
With Range("gender")
If Not (.Value Like "[Mm]ale" Or _
.Value Like "[Ff]emale") Then
Application.EnableEvents = False
.ClearContents
Application.EnableEvents = True
MsgBox "Gender must be ""Male"",""male""," & _
"""Female"", or ""female"""
End If
End With
End If
End Sub

where "gender" is the name of your "gender cell".
 

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

Top