• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Multiple actions in worksheet_change

ameyabrid

New Member
Hello Everyone,


I was wondering if it is possible to include two (2) separate actions in the worksheet_change event.
 
Ameyabrid


Firstly, Welcome to the Chandoo.org Forums


When you say 2 separate actions, the Worksheet Change event occurs when there is any change on the worksheet.


You can code inside the associated subroutine to check for any number of conditions

eg

if A1=1 and D20=10 then do something otherwise exit

if the change cell is within a range do something

etc


One a Change event is triggered you can do anything or any number of activities within the code.
 
Thanks for replying Hui,


I apologize for not being clear and specific about my requirements earlier. Here's a brief overview of what I would like to achieve:


If a cell in column P changes, do Action 1

If a cell in column L changes, do Action 2


I've made two separate subs for Actions 1 & 2 and I'm calling them in the worksheet_change event like this:


[/code]


Private Sub Worksheet_Change(ByVal Target As Range)


If Not Intersect(Target, Range("L6:L5000")) Is Nothing Then


Call Assignment


ElseIf Not Intersect(Target, Range("P6:p5000")) Is Nothing Then


Call StatusUpdate


Else


End If


End Sub


[/code]


I am getting a compile error in the line 'Call Assignment' and it says Argument not optional. Any thoughts??
 
I think I figured it out. I had included (ByVal Target As Range) in the sub headers for the "Assignment" and "StatusUpdate" routines which wasn't required. Thanks for your help Hui. I really appreaciate it.
 
Back
Top