ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Is it possible ?? (https://www.excelbanter.com/excel-discussion-misc-queries/234647-possible.html)

Trixie

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


Sheeloo

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



Simon Lloyd[_286_]

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



All times are GMT +1. The time now is 12:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com