ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Handling Worksheet Events of a Worksheet Created During Runtime. (https://www.excelbanter.com/excel-programming/388138-handling-worksheet-events-worksheet-created-during-runtime.html)

chatterbox

Handling Worksheet Events of a Worksheet Created During Runtime.
 
Hi Everyone.

I have a small program which creates a worksheet at runtime to display
the results of its analysis in the active workbook. I wish to use
either the worksheet SelectionChange or BeforeRightClick event to
respond to the user interacting with a specific section of the results
worksheet.

If the results worksheet is created at runtime, can anyone tell me how
I should code the user interaction worksheet event ?

If I must create some kind of dynamic worksheet event handler class,
are there examples out there ? Or is the proper solution more obvious
than that ?

Thanks in advance

Chatterbox


Tom Ogilvy

Handling Worksheet Events of a Worksheet Created During Runtime.
 
Why not use the Workbook level version of these events. This will pass in
the sheet where the event occured. Then you can decide, based on the name of
the sheet, whether to perform you action or not.

The alternative is to write the event code to the sheet event after you
create the sheet. I haven't done much serious work in this area, but it
always appeared "fragile" to me (error prone).
http://www.cpearson.com/excel/vbe.htm
for some sample code.

--
Regards,
Tom Ogilvy


"chatterbox" wrote:

Hi Everyone.

I have a small program which creates a worksheet at runtime to display
the results of its analysis in the active workbook. I wish to use
either the worksheet SelectionChange or BeforeRightClick event to
respond to the user interacting with a specific section of the results
worksheet.

If the results worksheet is created at runtime, can anyone tell me how
I should code the user interaction worksheet event ?

If I must create some kind of dynamic worksheet event handler class,
are there examples out there ? Or is the proper solution more obvious
than that ?

Thanks in advance

Chatterbox




All times are GMT +1. The time now is 07:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com