ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell Input Monitoring (https://www.excelbanter.com/excel-programming/355869-cell-input-monitoring.html)

parteegolfer

Cell Input Monitoring
 

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


K Dales[_2_]

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



parteegolfer

Cell Input Monitoring
 

Tried this code and nothing happened when I entered something other than
an "x" in any of the cells to be monitored. Any suggestions?


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


parteegolfer

Cell Input Monitoring
 

Nevermid. It was somethig I had done. Thanks for the response and help!


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



All times are GMT +1. The time now is 12:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com