#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Is it possible ??


Hi,

I've been watching and learning and utilizing some of the simpler VBA
code I've seen (you guys ROCK!), and was wondering how to incorporate
multiple Worksheet_Change subs in one sheet or if it's even possible?

For example I may have a sub that looks at a value and pops me a
msgbox, but also want to use a sub in the same worksheet that hides
rows..

I hope the question makes sense; I am a pretty green on VBA.

Thanks~


--
Trixie

~TRIXIE
------------------------------------------------------------------------
Trixie's Profile: http://www.thecodecage.com/forumz/member.php?userid=438
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=109133

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 793
Default Is it possible ??

You can not have multiple subs with the same name in the same scope...
so you can have only one Worksheet_Change sub for a give worksheet. You can
however call different subs (defined in standard modules, which do different
things) from the Worksheet_Change sub.


"Trixie" wrote:


Hi,

I've been watching and learning and utilizing some of the simpler VBA
code I've seen (you guys ROCK!), and was wondering how to incorporate
multiple Worksheet_Change subs in one sheet or if it's even possible?

For example I may have a sub that looks at a value and pops me a
msgbox, but also want to use a sub in the same worksheet that hides
rows..

I hope the question makes sense; I am a pretty green on VBA.

Thanks~


--
Trixie

~TRIXIE
------------------------------------------------------------------------
Trixie's Profile: http://www.thecodecage.com/forumz/member.php?userid=438
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=109133


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Is it possible ??


If you mean you want the same sub to work on each sheet change event
then simplyput your code in the Thisworkbook module using this:


Code:
--------------------
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
'YOUR CODE HERE
End Sub

--------------------


Trixie;390409 Wrote:
Hi,

I've been watching and learning and utilizing some of the simpler VBA
code I've seen (you guys ROCK!), and was wondering how to incorporate
multiple Worksheet_Change subs in one sheet or if it's even possible?

For example I may have a sub that looks at a value and pops me a
msgbox, but also want to use a sub in the same worksheet that hides
rows..

I hope the question makes sense; I am a pretty green on VBA.

Thanks~



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=109133

Reply
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



All times are GMT +1. The time now is 09:30 PM.

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"