Hi,
i have cells that say "no" in sheet1 that are then linked to another sheet via a formula, when they say yes i want a macro to run eg when cell a1 goes from "no" to "yes" run macro 1, when a2 goes from "no" to "yes" run macro 2 etc.
Also to stop a continuous loop when each macro has been run i want the cell to be cleared/empty.
Hi there,
You're actually looking for a Worksheet_Change event, not calculate, I think. Here's the framework:
It needs to go in the Sheet module for the sheet you want to run it on. Update your cell references, and then plug the code in at the "Do Something" part.Code:Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ExitPoint Application.EnableEvents = False Select Case Target.Address Case Is = "$A$1" 'Do something Target.ClearContents Case Is = "$B$5" 'Do something Target.ClearContents End Select ExitPoint: Application.EnableEvents = True End Sub
Hope it helps,
Ken Puls, FCPA, FCMA, MS MVP
Learn to Master Your Data at the Power Query Academy (the world's most comprehensive online Power Query training), with my book M is for Data Monkey, or our new Power Query Recipe cards!
Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter
If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.
Bookmarks