Format cell to display "Y" or "N"when entering a 1 or zero

  • Thread starter Thread starter Guest
  • Start date Start date
You can't. But right click sheet tab>view code>insert this.
Now if you are in the specified range you will get what you want

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("a2:a22")) Is Nothing Then
If Target = 1 Then Target = "Y"
If Target = 0 Then Target = "N"
End If
End Sub
 
Let me clarify further. How do I prevent someone from entering anything
other than a 1 or 0?

In other words, I want a 1 entered so the cell displays a "Y" or I want a 0
entered so the cell displays a "N". All other options should be invalid.
 
Data>Validation>Allow>Whole Number

Minimum.....0

Maximum.....1

The do the formatting as Toppers suggests.


Gord Dibben MS Excel MVP
 
Back
Top