Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to validate in code the contents of a cell?
I need to test the value in a cell that currently has
validation turned on values displayed in a list (combo box) The routine in VBA is as follows: Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) WorkID = ActiveCell().Text If WorkID = "Flex" Then MsgBox "Please complete Flex-Time Form" End Sub My problem is that it only fires when I leave the cell and return back...How can I test the value in cell before, or as, I get to the next cell? This is Excel '97 Thanks, Heather. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to validate in code the contents of a cell?
Try using the worksheet's Change event instead of the
SelectionChange event. Change is fired when a value is entered. In the parameter list 'Target' is the range that changed, so I should recommend that you use Target.Value in preference to Activecell.Value Patrick Molloy Microsoft Excel MVP -----Original Message----- I need to test the value in a cell that currently has validation turned on values displayed in a list (combo box) The routine in VBA is as follows: Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range) WorkID = ActiveCell().Text If WorkID = "Flex" Then MsgBox "Please complete Flex- Time Form" End Sub My problem is that it only fires when I leave the cell and return back...How can I test the value in cell before, or as, I get to the next cell? This is Excel '97 Thanks, Heather. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Create HTML code for a hyperlink from cell contents | Excel Worksheet Functions | |||
Have code check cell contents on edit. | Excel Worksheet Functions | |||
VBA code to copy cell contents from one sheet to another | Excel Worksheet Functions | |||
Validate Cell contents in formlua | Excel Worksheet Functions | |||
run code after cell contents change | Excel Programming |