My VBA is a bit rusty so I am having trouble building an application that automatically updates some cells when the value of a cell is modified.
I've started with this basic subroutine, located on a Worksheet
page:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = True
If Not Intersect(Target, Target.Worksheet.Range("A1")) Is Nothing Then
MsgBox "Lorem Ipsum"
End If
End Sub
This subroutine should pop-up a message box Lorem Ipsum when cell A1's value is modified.
However this is not working. I've been unable to find where is the issue; typical problems (subroutine located in a module, EnableEvents
turned False
) should not happen with the code above; I've also tried to change Target.Worksheet.Range("A1")
to Range("A1")
.
Does anyone know where is the issue coming from?
I copied your code and it worked as one should expect. Note though that you need to manually edit cell A1 on the worksheet where the code is to get up the MsgBox. Recalculation has no bite on the worksheet change event.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.