View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben
 
Posts: n/a
Default regular code module

billy

The Code Module code goes into the Thisworkbook module.

For Regular code select InsertModule


Gord Dibben Excel MVP

On Tue, 13 Dec 2005 10:53:01 -0800, billy boy
wrote:

I was told to put something in a code module and something into a regular
code module. My problem is I know where to put it into a code module but
where do I find a regular code module?
This is what I have:

CODE MODULE:Private Sub Workbook_SheetSelectionChange( _
ByVal Sh As Object, ByVal Target As Range)
Application.EnableEvents = False
SynchSheets
Application.EnableEvents = True
End Sub

REGULAR CODE MODULE:Sub SynchSheets()
' Duplicates the active sheet's active cell upperleft cell
' Across all worksheets
If TypeName(ActiveSheet) < "Worksheet" Then Exit Sub
Dim UserSheet As Worksheet, sht As Worksheet
Dim TopRow As Long, LeftCol As Integer
Dim UserSel As String

Application.ScreenUpdating = False

' Remember the current sheet
Set UserSheet = ActiveSheet

' Store info from the active sheet
TopRow = ActiveWindow.ScrollRow
LeftCol = ActiveWindow.ScrollColumn
UserSel = ActiveWindow.RangeSelection.Address

' Loop through the worksheets
For Each sht In ActiveWorkbook.Worksheets
If sht.Visible Then 'skip hidden sheets
sht.Activate
Range(UserSel).Select
ActiveWindow.ScrollRow = TopRow
ActiveWindow.ScrollColumn = LeftCol
End If
Next sht

' Restore the original position
UserSheet.Activate
Application.ScreenUpdating = True
End Sub