VBA: Worksheet.OnActivate

I have a method in my VBA code that needs to be assigned to a workbook.

I tried:

sht.Onactivate = "Sheet_Activate"

However, this does not work. How can I assign this method to the worksheet.OnActivate event using VBA code?


If the code needs to apply to the worksheet staticly (meaning, this code should always be hooked with the worksheet's activate event), you can simply add the following in the worksheet's VBA editor:

Private Sub Worksheet_Activate()
End Sub

I was able to assign a method to the event using the following code:

sheet.OnSheetActivate = "MyOwn_Activate"

Private Sub MyOwn_Activate()


End Sub

In the VBA editor, in the Project Explorer Select the worksheet, right click and select View Code In the upper left drop down list choose Worksheet In the upper right drop down list choose Activate

You can also do this in the Workbook object gl hf

Need Your Help

Pointers to structures and memory allocation in C

c pointers memory-management struct

Got 2 things here to which I can't seem to find an answer... I am working on a project for the university where we (we're 3) are developing the entire Client side of a board game (e.g. server

MonoTouch - Setting Bundle - iPhone

iphone xamarin.ios bundle

I am trying to create a app preference so that users can store prefs.