ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Running a macro by changing a cell value (https://www.excelbanter.com/excel-programming/325814-re-running-macro-changing-cell-value.html)

Dave[_54_]

Running a macro by changing a cell value
 
Foiled by Delete!

I use the following code to run a macro called "UpdateE5" whenever cell E4
is edited.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("E4")) Is Nothing Then
If Range("E4").Value < gOldE4 Then
gOldE4 = Range("E4").Value
Application.Run "UpdateE5"
End If
End If
End Sub

It works for any change in cell E4 except when that change is brought about
by the use of the Delete key.
ie, select cell E4, hit Delete, and pooh! Nothing!
Is this possible to overcome?
Regards - Dave B.



OJ[_2_]

Running a macro by changing a cell value
 
What version are you using? Works for me....XL2002SP3 & XP

Why not use
If Target.Address instead of Intersect?

OJ



All times are GMT +1. The time now is 04:54 PM.

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