View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default SheetActivate/DeActivate events in a common module

Put similar code in both your ThisWorkbook module and in the 'common' sheet
module that might get copied, obviously the event procedure names will be
slightly different.

In the ThisWorkbook module early abort if the sheet is the 'common' sheet as
similar code will already have been processed in the sheet event code. Eg -

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim sName As String

sName = UCase(Sh.Name)

Select Case Sh.Name
Case "COMMON"
'do nothing, already handled in that sheet's event code
Case "SHEET2"
' Sheet2 code
Case Else
' code for other sheets
End Select

End Sub

Regards,
Peter T


"Dileep Chandran" wrote in message
oups.com...


You are right, Nick. But I have to move this codes along when we copy
a particular sheet (A sheet common to all workbooks, Workbook code
name is Testing) to another workbook.

Can it be done?

-DC