KP_SoCal
Board Regular
- Joined
- Nov 17, 2009
- Messages
- 116
The code below restricts users from inputting anything other than an uppercase "X" in a cell within column N. If the user types a lowercase "x", it would automatically convert it to uppercase. If any other value is entered other than "X", a message box will fire.
The code is specific to column N (column 13). However, I would like to apply this to multiple columns, such as columns 13,14,17,20.
Any suggestions on how I would rewrite this code? Thanks!
The code is specific to column N (column 13). However, I would like to apply this to multiple columns, such as columns 13,14,17,20.
Any suggestions on how I would rewrite this code? Thanks!

Code:
If Target.Column = 13 And Target.Value <> "X" And Target.Value <> "x" And Target.Value <> "" Then
Target.ClearContents
Cells(Target.Row, IIf(Target.Column = 13, 13, 13)).Select
MsgBox "Value" & Chr$(34) & "X" & Chr$(34) & " is the only value allowed.", _
vbInformation + vbOKOnly
ElseIf Target.Column = 13 And Target.Value = "x" Then
Target = UCase(Target)
End If