View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Cell Input Monitoring

You can use the Worksheet_Change event procedure. In the VBA editor, view
the project explorer and double-click on the worksheet you are using. Then
in the code pane type this code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim TestCell As Range, Invalid As Boolean
If Not (Intersect(Target, Range("H9:J400")) Is Nothing) Then
For Each TestCell In Target.Cells
Invalid = Invalid Or TestCell.Value < "X"
Next TestCell
End If
If Invalid Then
MsgBox "You must enter 'X' here"
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
End Sub

--
- K Dales


"parteegolfer" wrote:


I am looking to only allow an "X" be entered in Columns H9:H400,I9:I400
and J9:J400. If anything else is inserted in any of these cells a
Message box will pop up stating only an "X" can be entered in this
cell.

Any Ideas?

Thanks in advance!:)


--
parteegolfer
------------------------------------------------------------------------
parteegolfer's Profile: http://www.excelforum.com/member.php...o&userid=31951
View this thread: http://www.excelforum.com/showthread...hreadid=521816