LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell entry triggers Worksheet_SelectionChange event Daniel.C[_3_] Excel Programming 4 November 21st 09 02:41 PM
thisworkbook.saveAs triggers change event? Alerion Excel Programming 3 April 6th 07 07:46 AM
Copying Worksheet triggers Click event of combobox Copying Worksheet triggers click event on combobox Excel Programming 2 January 25th 04 10:51 PM
Copying Worksheet triggers Click event of combobox on another worksheet Robert[_20_] Excel Programming 0 January 23rd 04 07:40 PM
Click event on cell triggers a macro kris Excel Programming 2 November 13th 03 10:42 AM


All times are GMT +1. The time now is 06:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"