Home |
Search |
Today's Posts |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Cell Change triggers Worksheet Event
Hi
This should do it: Private Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range On Error GoTo errExit Application.EnableEvents = False Set rng = Range("S2:S75") If Not Intersect(Target, rng) Is Nothing Then If Target.Value < 0 Then ' do something MsgBox Target.Value End If End If errExit: Application.EnableEvents = True End Sub Regards, Per "Charles" skrev i meddelelsen ... HI, I'm trying to trigger a worksheet event thru a cell or cells value being changed. I found this code in this forum and it does what I'm trying to do, however, I'm trying to have the event activated when a cell value change within a column. The range I'm looking at is Range("S2:S75"). The values in this range are derived by a formula. Here's the code Private Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range On Error GoTo errExit Application.EnableEvents = False Set rng = Range("s7").Precedents If Not Intersect(Target, rng) Is Nothing Then If Range("s7").Value < 0 Then ' do something MsgBox Range("s7").Value End If End If errExit: Application.EnableEvents = True End Sub This code works, but it only looks at 1 cell, and I need it to look at the range specified. Any help or suggestion would be appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cell entry triggers Worksheet_SelectionChange event | Excel Programming | |||
thisworkbook.saveAs triggers change event? | Excel Programming | |||
Copying Worksheet triggers Click event of combobox | Excel Programming | |||
Copying Worksheet triggers Click event of combobox on another worksheet | Excel Programming | |||
Click event on cell triggers a macro | Excel Programming |