View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Jared Jared is offline
external usenet poster
 
Posts: 109
Default Worksheet.activate question

Try This

In module# insert
sub any_name()
Include all the statements in your Worksheet_Activate code
end sub

then call this procedure both when the workbook is opened and when
worksheet1 is activated.

"Tim Coddington" wrote:

I get a "Compiler Error:

Method or data member not found" error on that one (Call
Sheet1.Worksheet_Activate).

But makes me think. Would Worksheet_Activate for sheet1 be found in the VBA
object? I couldn't find it. Or perhaps in the VBA.IDE (none such exists)
object?

"Dave Peterson" wrote in message
...
Another way:

In the ThisWorkbook module:

Option Explicit
Private Sub Workbook_Open()
Call Sheet1.Worksheet_Activate
End Sub

in the Sheet1 module:
Option Explicit
Sub Worksheet_Activate()
MsgBox "hi from activate"
End Sub

Notice that I removed the word "Private" from the Sub line:
Private Sub Worksheet_Activate()

so the sub can be found.



Tim Coddington wrote:

Stupid question time ...

How can I get the Worksheet_Activatecode (for sheet1) to activate from
Workbook_Open() (even if sheet1 is already active)?
I tried just sticking the Worksheet_Activate command in Workbook_Open(),

but
that doesn't seem to be accessable from Workbook_Open().


--

Dave Peterson