Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In my opinion (for whatever that is worth) if the code for the button only
applies to this one sheet then It belongs in the sheet (where sparker has it). If the code is more generic and could be used by many sheets and modules then it belongs in a module. Depends entirely on the scope from my standpoint, but I probably should have noted your solution also. Good point. -- HTH... Jim Thomlinson "bhofsetz" wrote: Personally I would put the code behind the button click event into a standard module as a subroutine. Then I would use the button click event to call that subroutine. Then you can also call the same sub from another function or macro. ie, change this: Private Sub CommandButton1_Click() 'Your code here End Sub to: 'In the code behind the sheet Private Sub CommandButton1_Click() ButtonCode End Sub 'In a standard code module Sub ButtonCode 'Your code here End Sub Then you can call the ButtonCode sub from any function of subroutine -- bhofsetz ------------------------------------------------------------------------ bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807 View this thread: http://www.excelforum.com/showthread...hreadid=381403 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
code is not to work on sheet1 | New Users to Excel | |||
code in module A to not execute a Worksheet_SelectionChange sub of another module | Excel Discussion (Misc queries) | |||
Create a newworksheet with VBA code and put VBA code in the new worksheet module | Excel Programming | |||
Use VB code to remove code in sheet1 | Excel Programming |