Compare address to a range
Dim isect As Range
Set isect = Application.Intersect(Target, Range("$BC$3:$BC$7"))
If isect Is Nothing Then
MsgBox "Target NOT in range"
Else
MsgBox "Target IS in range"
End If
You can also test against use multiple ranges. (Note that a space and
underscore at the end of a line is a line break in an otherwise single line
of code.)
Set isect = Application.Intersect _
(Target, Union(Range("$BC$3:$BC$7"), _
Range("$BC$13:$BC$17")))
--
Regards,
OssieMac
"dhstein" wrote:
I have this code in an event macro:
If Target.Address = "$BC$3" Or Target.Address = "$BC$4" Or Target.Address =
"$BC$5" Or Target.Address = "$BC$6" Or Target.Address = "$BC$7" Then
Is there a more compact way to write that statement? Thanks for any help on
this.
|