|
-
Nov 10th, 2003, 05:33 PM
#1
Thread Starter
New Member
Testing for cell values in Excel 97 ?
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,
-
Nov 13th, 2003, 06:54 PM
#2
Hyperactive Member
workid = Me.Cells.SpecialCells(xlCellTypeLastCell).Text is how, but I have a feeling it will be tough. The message will fire as you leave the cell, but clicking the message box will fire the SelectionChange again and you'll be stuck in a loop.
-
Nov 14th, 2003, 06:56 AM
#3
Frenzied Member
Just make sure you check the ActiveCell.Address to be the right cell...
VB Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Address = "$A$1" Then
'All your code here
End If
End Sub
That way it will only fire on the cell you want to check, I use it all the time to turn cells into buttons.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|