ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro not running when cell value is updated (https://www.excelbanter.com/excel-programming/344751-macro-not-running-when-cell-value-updated.html)

Jon[_21_]

Macro not running when cell value is updated
 
I want to run a macro when a cell value changes. I have the following
code to do this:

Private Sub WorkSheet_Change(ByVal Target As Range)

If Target.Address = "$E$5" And Target.Value = 1 Then
Call Archive
End If

End Sub

When I manually enter a 1 into cell E5, the macro runs fine. However,
E5 normally contains =IF(G5=5,1,0) so when G5 is 5, E5 is changed to 1
(auto calculate is on) but my macro does not run when this happens. It
will only run when I manually enter 1 or when I click the formula and
press enter to accept it. Why is my macro not running?


Leith Ross[_224_]

Macro not running when cell value is updated
 

Hello Jon,

This event doesn't occur when cells change during a recalculation. Use
the Calculate event to trap a sheet recalculation. This event isn't
triggered either when cells are deleted.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=482221



All times are GMT +1. The time now is 12:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com