Excel Run macro upon cell edit

Joined
Feb 6, 2017
Messages
1
Reaction score
0
Hello,

I'm pretty inexperienced with VBA. I'm trying to have a pretty simple macro run whenever a certain range of cells are edited. I've seen how to do this posted all over the place, but for some reason it will not work for me. The macro I'm using is as follows:

Sub Workbook_Update(ByVal Target As Range)
Dim KeyCells As Range

' The variable KeyCells contains the cells that will
' cause an alert when they are changed.
Set KeyCells = Range("A3:C3")

If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then

' Display a message when one of the designated cells has been
' changed.
' Place your code here.
MsgBox "Cell has changed."

Range("A8:C356").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("A2:C3"), Unique:=False

End If
End Sub

This was basically grabbed from the web. The only changes I made were to the range of KeyCells and to add the line that creates an advanced filter. I grabbed that line from a macro I recorded, which would work just fine when I used the hotkey.

I'm running excel 2013 and I've made sure to enable macros in my security settings. I haven't been able to find much to explain why this macro is not being run when I edit a cell in range A3:C3.

Thanks in advance,
Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top