ltdanp22
asked on
Application.Intersect Not Working
I'm using the following code to check the value of a cell:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells1 As Range
Dim KeyCells2 As Range
Dim KeyCells3 As Range
' The variable KeyCells contains the cells that will cause an alert when they are changed.
Set KeyCells1 = Range("J5:J100")
Set KeyCells1 = Range("L5:L100")
Set KeyCells1 = Range("N5:N100")
If Not Application.Intersect(KeyC ells1, Range(Target.Address)) Is Nothing Then
If IsTime(Target) = False Then
MsgBox "Cell " & Target.Address & " is not a valid time."
End If
' Display a message when one of the designated cells has been changed.
' Place your code here.
MsgBox "Cell " & Target.Address & " has changed."
End If
End Sub
For some reason the "If Application.Intersect" line returns "Nothing" when I click cell J5 even though the value of Target.Address is "$J$5".
Any ideas why that's happening?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells1 As Range
Dim KeyCells2 As Range
Dim KeyCells3 As Range
' The variable KeyCells contains the cells that will cause an alert when they are changed.
Set KeyCells1 = Range("J5:J100")
Set KeyCells1 = Range("L5:L100")
Set KeyCells1 = Range("N5:N100")
If Not Application.Intersect(KeyC
If IsTime(Target) = False Then
MsgBox "Cell " & Target.Address & " is not a valid time."
End If
' Display a message when one of the designated cells has been changed.
' Place your code here.
MsgBox "Cell " & Target.Address & " has changed."
End If
End Sub
For some reason the "If Application.Intersect" line returns "Nothing" when I click cell J5 even though the value of Target.Address is "$J$5".
Any ideas why that's happening?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER