View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tim Zych Tim Zych is offline
external usenet poster
 
Posts: 389
Default Why is this Worksheet Change Event triggered?

Just as a side-note, ActiveCell is likely not the same as the changed cell.

To see this in action, type a value in a cell and hit the Enter key while
using the test macro below. ActiveCell is the next cell below, while Target
is the actual cell which has been changed. Or in your case,
ActiveCell.Offset(1,0) is two cells from the changed value, not one as you
might surmise.

Private Sub Worksheet_Change(ByVal Target As Range)
Debug.Print ActiveCell.Address
Debug.Print Target.Address
End Sub

--
Regards,
Tim Zych
http://www.higherdata.com
Workbook Compare - Excel data comparison utility

"AJ Master" wrote in message
...
I have a model with 3 worksheets, I'm executing code on Sheet 2 that
changes a cell value on Sheet 1, specifically cell "FF198". When I
update this cell the worksheet change event for sheet 1 is triggered
(which I expect) but then it halts on the last line of code and I
receive an error that states: "Run-time error 1004: Select method of
range class failed". Any ideas as to why this is happening??

If I am working on sheet 1 and making changes to values I never
receive this error, so what am I doing that causes the error? Any
thoughts would be appreciated!...Thx....AJ

I have set up the worksheet change event on Sheet 1 with the following
code:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim LocationRange As Range
Dim sNextCell As String

sNextCell = ActiveCell.Offset(1, 0).Address

Set LocationRange = Range("escalationtype1",
"escalationtype2") 'range O86 & range D136

If Not Intersect(Target, LocationRange) Is Nothing Then
FormatEscalationType
End If

Range(sNextCell).Select <=====this is the code the debugger
highlights

End Sub