PDA

View Full Version : Worksheet_Change Query



ukyank
09-10-2009, 01:35 AM
Sorry for asking a very dumb question but I can't seem to get this very basic example to work. I copied it from Mircosoft's help but no luck I dont get a msgbox:

Private Sub Worksheet_Change(ByVal Target as Range)
Dim keyCells as Range
Set keyCells = Range ("D5:E11")
If Not Application.Intersect(keyCells , Range(Target.Address)) is Nothing Then
Msgbox "Cell: " & Target.Address & " has changed"
End If

Sorry I am totally new to VBA in Excel and am just trying to get this working so I can expand and use it for an attendance sheet

ukyank
09-10-2009, 01:43 AM
copied into a new spreadsheet and it worked.

p45cal
09-10-2009, 04:50 AM
I think replacing:
Range(Target.Address)
with just:
Target
should work