View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
lexcel lexcel is offline
external usenet poster
 
Posts: 34
Default Can I enter a "Y" and return "Yes" in the same cell? PART 2

Right click on the tab of the sheet you wish to have this behaviour.
In the menu click "View Code"
In the VBA window that opens paste the following code (from '===== to
'=====)

' ==========================================
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range

Application.EnableEvents = False
For Each cell In Target
Select Case LCase(cell.Text)
Case "y", "yes"
cell = "Yes"
Case "n", "no"
cell = "No"
End Select
Next cell
Application.EnableEvents = True
End Sub
' ==========================================

I made it so that it will also take "no" for an answer. If you don't
want this, remove the lines
Case "n", "no"
cell = "No"

Greetz,

Lex