PC Review


Reply
Thread Tools Rate Thread

Can I have two worksheet_change events in same worksheet?

 
 
=?Utf-8?B?a2x5c2VsbA==?=
Guest
Posts: n/a
 
      28th Aug 2007
Hi,

Can I have two worksheet_change procedures within the same worksheet code
window? If so, how do I differentiate between the two procedures without
there being a conflict? Upon enacting one of the worksheet_change events, I
have the message that there has been an ambiguous naming conflict in my code.

Thanks,
--
Kent Lysell
Financial Consultant
Ottawa, Ontario
W: 613.948-9557
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      28th Aug 2007
Kent,

there can only be one worksheet_change event procedure for each worksheet.


--
Hope that helps.

Vergel Adriano


"klysell" wrote:

> Hi,
>
> Can I have two worksheet_change procedures within the same worksheet code
> window? If so, how do I differentiate between the two procedures without
> there being a conflict? Upon enacting one of the worksheet_change events, I
> have the message that there has been an ambiguous naming conflict in my code.
>
> Thanks,
> --
> Kent Lysell
> Financial Consultant
> Ottawa, Ontario
> W: 613.948-9557

 
Reply With Quote
 
=?Utf-8?B?UGZsdWdz?=
Guest
Posts: n/a
 
      28th Aug 2007
You cannot have two Worksheet_Change events. Rahter, the separate task
should be place within the same procedure, and IF-THEN blocks should be used
to allow either, both, or none to run.

Pflugs

"klysell" wrote:

> Hi,
>
> Can I have two worksheet_change procedures within the same worksheet code
> window? If so, how do I differentiate between the two procedures without
> there being a conflict? Upon enacting one of the worksheet_change events, I
> have the message that there has been an ambiguous naming conflict in my code.
>
> Thanks,
> --
> Kent Lysell
> Financial Consultant
> Ottawa, Ontario
> W: 613.948-9557

 
Reply With Quote
 
=?Utf-8?B?a2x5c2VsbA==?=
Guest
Posts: n/a
 
      28th Aug 2007
Is there any way to combine the two under one procedure?
--
Kent Lysell
Financial Consultant
Ottawa, Ontario
W: 613.948-9557


"Vergel Adriano" wrote:

> Kent,
>
> there can only be one worksheet_change event procedure for each worksheet.
>
>
> --
> Hope that helps.
>
> Vergel Adriano
>
>
> "klysell" wrote:
>
> > Hi,
> >
> > Can I have two worksheet_change procedures within the same worksheet code
> > window? If so, how do I differentiate between the two procedures without
> > there being a conflict? Upon enacting one of the worksheet_change events, I
> > have the message that there has been an ambiguous naming conflict in my code.
> >
> > Thanks,
> > --
> > Kent Lysell
> > Financial Consultant
> > Ottawa, Ontario
> > W: 613.948-9557

 
Reply With Quote
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      28th Aug 2007
You can use Select, or If statements to call a different sub procedure
depending on certain conditions.. but they have to be under just one
worksheet_change event procedure.. for example:

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$A$1":
MsgBox "execute a sub procedure"
Case "$A$2":
MsgBox "execute a different sub procedure"
End Select
End Sub



--
Hope that helps.

Vergel Adriano


"Vergel Adriano" wrote:

> Kent,
>
> there can only be one worksheet_change event procedure for each worksheet.
>
>
> --
> Hope that helps.
>
> Vergel Adriano
>
>
> "klysell" wrote:
>
> > Hi,
> >
> > Can I have two worksheet_change procedures within the same worksheet code
> > window? If so, how do I differentiate between the two procedures without
> > there being a conflict? Upon enacting one of the worksheet_change events, I
> > have the message that there has been an ambiguous naming conflict in my code.
> >
> > Thanks,
> > --
> > Kent Lysell
> > Financial Consultant
> > Ottawa, Ontario
> > W: 613.948-9557

 
Reply With Quote
 
=?Utf-8?B?a2x5c2VsbA==?=
Guest
Posts: n/a
 
      28th Aug 2007
Thanks all.
--
Kent Lysell
Financial Consultant
Ottawa, Ontario
W: 613.948-9557


"Pflugs" wrote:

> You cannot have two Worksheet_Change events. Rahter, the separate task
> should be place within the same procedure, and IF-THEN blocks should be used
> to allow either, both, or none to run.
>
> Pflugs
>
> "klysell" wrote:
>
> > Hi,
> >
> > Can I have two worksheet_change procedures within the same worksheet code
> > window? If so, how do I differentiate between the two procedures without
> > there being a conflict? Upon enacting one of the worksheet_change events, I
> > have the message that there has been an ambiguous naming conflict in my code.
> >
> > Thanks,
> > --
> > Kent Lysell
> > Financial Consultant
> > Ottawa, Ontario
> > W: 613.948-9557

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet_Change - initiate macro on another worksheet oms Microsoft Excel Programming 4 11th Mar 2008 03:26 PM
Combine 2 codes from WorkSheet_Change & WorkSheet _SelectionChange to ONLY WorkSheet_Change Corey Microsoft Excel Programming 2 17th Dec 2006 09:59 PM
Call Worksheet_Change macro in another worksheet =?Utf-8?B?RnJlZGR5?= Microsoft Excel Programming 6 29th Oct 2006 07:16 PM
Excel Consequential Events Worksheet_SelectionChange and Worksheet_Change tkt_tang@hotmail.com Microsoft Excel Discussion 0 22nd Jan 2006 03:15 AM
Worksheet_change vs. worksheet_selection_change events zSplash Microsoft Excel Programming 2 20th Mar 2004 10:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:36 PM.