Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edit Excel Worksheet VBA using VBA?

Status
Not open for further replies.

LastDance74

Programmer
Sep 13, 2001
6
AU
I have an Excel worksheet that, depending on selections made by the user, generates a new worksheet in the same workbook.

I have all this working fine but have hit a problem when trying to add a command buttons on_click event code and a few other little subprocedures to the new worksheet.

Is it possible to edit the new sheets code using VBA at runtime? When I create the Command button object how do I set it's events?

Thanks for any insight :)
Sam.
 
Hi,
When you add the button, assign the OnAction property to the macro you want to execute...
Code:
ActiveSheet.CommandButton1.OnAction = "MacroName"
I would imagine that procedure, MacroName, would have to be generalized to perform the desired actios.

I hope that this helps. :) Skip,
metzgsk@voughtaircraft.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top