View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bill Renaud Bill Renaud is offline
external usenet poster
 
Posts: 417
Default Macro to slightly modify the subroutine

I think this is a very dangerous concept. Adding or modifying code in a
workbook that is already running a macro can cause Excel to crash or
completely lock up.

Maybe if you post your code for Command1, we can help you make it generic,
so that it will work on all worksheets. There is nothing wrong with having
multiple Forms buttons in a workbook that all call the same macro. The
macro just needs to start by setting an object variable to the active
sheet, as follows:

Sub DoStuff()
Dim wsActive as Worksheet

Set wsActive = ActiveSheet

'Perform your actions here.
End Sub

--
Regards,
Bill Renaud