Sheet event doesn't work in '97
Seems we were posting earlier at the same time.
Having incorrectly answered your question I hesitate to go
further, but...
whats the difference between Change and SelectionChange
Change - fires when cell entry is changed.
SelectionChange - fires when a cell or range of cells is
selected.
When entries are deleted it causes an error
You are changing the cells thereby triggering
your "Change" code.
To clarify my first post, your code worked if I entered a
cell in Col 6 w/out a ^ in "abc^" matching your your other
criteria. If I changed it from Change to SelectionChange
it also worked when I selected a cell in Col 6 (which I
wrongly thought might be your intention).
The other posts should help you more.
Regards,
Sandy
-----Original Message-----
I am a novice as far as sheet code goes, whats the
difference between Change
and SelectionChange? I want the code to 'fire' when a
selection is made
from the data validation list (the cell is blank).
I tried MsgBox Application.EnableEvents and got 'TRUE'.
The code still doesn't work, if I type the value from the
list, it does!
I'm not sure why I'm disabling events either, I think
what I need is some
kind of error handling. When entries (a few cells at a
time) are deleted it
causes an error.
Hope you can help.
Gareth
"Sandy V" wrote in
message
...
Your code works as expected for me in XL97. However are
you sure you want this in a "Worksheet_Change" event
rather than in "Worksheet_SelectionChange"
Not sure why you are disabling events. If events have
not
been re-enabled for any reason that would disable your
event code. If you think your code is not working try
this in a normal module:
MsgBox Application.EnableEvents
Regards,
Sandy
savituk yahoo co uk
-----Original Message-----
Can anyone help?
I have the following code which works fine on 2000 but
in
work we have '97
and the sheet event doesn't fire when selecting items
from a drop down
valuidation list in column F.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
On Error GoTo ws_exit
If Target.Column = 6 Then
If Target.Offset(0, -5).Value <= Worksheets
("Sheet2").Range("A1").Value
Then
If Right(Target.Value, 1) = "^" Then
MsgBox "Error, you must choose one without
a
roof on!"
End If
ElseIf Target.Offset(0, -5).Value
Worksheets("Sheet2").Range("A1").Value Then
If Right(Target.Value, 1) < "^" Then
MsgBox "Error, you must choose one with a
roof on!"
End If
End If
End If
ws_exit:
Application.EnableEvents = True
End Sub
This check is very important, is there any other way to
do it?
Thanks in advance.
Gareth
.
.
|