View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Sheet activate question

Change Private to Public Sub Worksheet_Activate()

Private Sub Workbook_Open()

Set ws = Sheet1 ' or Worksheets("Sheet1")

On Error GoTo errH
If ws Is ActiveSheet Then
Call ws.Worksheet_Activate
End If

Exit Sub
errH:
If Err = 438 Then
Debug.Print ws.Name; "_Worksheet_Activate doesn't exist " & _
"or is Private"
Else
Debug.Print Err.Description
End If

End Sub

If you want to call the activate event on any sheet that happens to be
active as the workbook opens start with -

ws = activesheet

There are probably better ways to acheive the same overall objective

Regards,
Peter T


"Robert Crandal" wrote in message
...
I have 5 sheets that each process "Worksheet_Activate()". When
my workbook first opens, Sheet1 is automatically selected by
default as the first active sheet, however it does not receive any
"Activate" event when the workbook is first loaded.

What is a good way to ensure that the default activated sheet's
"Worksheet_Activate()" handler is called??

thank you!