ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change Cell Event (https://www.excelbanter.com/excel-programming/419464-change-cell-event.html)

snax500

Change Cell Event
 
How do I code an event change macro that triggers when cell A2 is
changed.

Thanks

Susan

Change Cell Event
 
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

If Target = ActiveSheet.Range("$A$2") Then
MsgBox "Hello"
End If

End Sub

substitute the msgbox with your code.......
hope that helps!
:)
susan


On Nov 3, 12:19*pm, snax500 wrote:
How do I code an event change macro that triggers when cell A2 is
changed.

Thanks



Gord Dibben

Change Cell Event
 
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'Private Sub Worksheet_Calculate()
On Error GoTo stoppit
Application.EnableEvents = False
With Me.Range("A2")
If .Value < "" Then
MsgBox "A2 was just changed"
End If
End With
stoppit:
Application.EnableEvents = True
End Sub

Right-click on the sheet tab and "View Code"

Copy/paste into that sheet module. Edit to suit.


Gord Dibben MS Excel MVP


On Mon, 3 Nov 2008 09:19:06 -0800 (PST), snax500
wrote:

How do I code an event change macro that triggers when cell A2 is
changed.

Thanks




All times are GMT +1. The time now is 01:19 AM.

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