Forum Discussion
lillyg424
Dec 07, 2018Copper Contributor
Macro
Hi, So i have created a macro in my excel sheet, and I was wondering if it is possible to have the macro be automatic every time the certain cell is equal to my specification, rather than me hav...
erol sinan zorlu
Dec 10, 2018Iron Contributor
You should use the worksheet change event on the worksheet that your cell is. this event has a Target variable that is the address of the cell that is changed. so you can write an IF statement within your change event to check the address of the cell and if the address is the same with your cell, call the macro.
Private Sub Worksheet_Change(ByVal Target As Range)
if target.address="$A$2" then call MyMacroName 'this is the name of the public sub that is in your macro module
end sub