Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create HTML code for a hyperlink from cell contents Billy_McSkintos Excel Worksheet Functions 1 January 26th 11 04:20 AM
Have code check cell contents on edit. Andrew Excel Worksheet Functions 1 January 16th 08 04:47 AM
VBA code to copy cell contents from one sheet to another Gimp Excel Worksheet Functions 0 February 23rd 07 05:18 PM
Validate Cell contents in formlua Jwbuddy386 Excel Worksheet Functions 1 July 18th 05 05:42 PM
run code after cell contents change Brian Excel Programming 0 September 5th 03 08:37 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"