Help needed - worksheet_change event triggering macro twice

GopherUK

Active Member
Joined
Jan 23, 2009
Messages
473
Hi,

I am looking for some help here as I am kinda stumped as to what is causing the problem here.

I am using 2007 and I have several sheets with tables in the. In the last field in each table, there is a drop-down list to select how the information in that row will be processed.

I originally used this sort of range reference: -

PHP:
 if target.column = 17 And activecell.offset(0,-1) = "processrange"
Everything worked fine. However, to make things a but more accurate, I added this type of thing: -

PHP:
If InRange(ActiveCell, Range("TransactionLog[REPROCESS]")) Then...
Using this function: -

PHP:
Public Function InRange(Range1 As Range, Range2 As Range) As Boolean

Dim InterSectRange As Range
    Set InterSectRange = Application.Intersect(Range1, Range2)
    InRange = Not InterSectRange Is Nothing
    Set InterSectRange = Nothing
End Function
The problem now is that it is triggering the desired macro twice. Nothing else is different at all - it just simply seems to do this when the InRange function is used to identify the cell as belonging to the desired range.

Does anybody have any idea what might be causing this?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Do you mean that the worksheet_change event is firing twice? If that is the case, is any of the code that is called by the worksheet_change, actually changing a cell? If that is the case then you can disable the worksheet_change procedure by using Application.EnableEvents=False but then making sure that you set it back to True afterwards.

HTH
DK
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,738
Members
452,940
Latest member
Lawrenceiow

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top