Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Fire Worksheet_change event from module

Think I misread your question. As OssieMac suggests use the events exposed
in the ThisWorkbook module, if necessary include some If or Select case to
cater for different 'set's of sheets.

Regards,
Peter T


"Peter T" <peter_t@discussions wrote in message
...
Change Private to Public, eg

Public Sub Worksheet_Change(ByVal Target As Range)

and to call it from elsewhere in your project, eg

Sheet1.Worksheet_Change Range("A1")
Worksheets("Sheet1").Worksheet_Change Range("A1")

Unless you are certain Sheet1 will never be deleted, call with
Worksheets("Sheet1").

Whilst this should work, I think a better way would be to move the bulk of
the event code to a normal module, eg

Sub wsChange(ws As Worksheet, Target As Range)
' code
End Sub

from the worksheet event call it like this
Private Sub Worksheet_Change(ByVal Target As Range)
wsChange Me, Target
End Sub

Call it similarly from anywhere else but change 'Me' to [say] ActiveSheet

Regards,
Peter T



"avi" wrote in message
...
Hello,

Is there a way to trigger a worksheet_change event from code placed in
a regular module and not in the sheet itself?

Or what is the approach to trigger a worksheet change event when I
don't know in advance which sheet will be involved and don't want to
insert code at each created sheet?

Thanks a lot
Avi







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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet_Change does it fire for a cell changed via foruma? [email protected][_2_] Excel Programming 3 April 10th 08 05:16 PM
event fire Curt Excel Programming 19 March 7th 07 12:29 AM
Can't get Sheet_Change event to fire - please help [email protected] Excel Programming 4 November 30th 06 04:28 AM
Event doesn't fire Frank Xia Excel Discussion (Misc queries) 6 February 11th 06 12:54 AM
Worksheet_Change event won't fire to execute Macro??? jpdill5 Excel Programming 2 February 13th 04 02:34 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"