Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default Copy Button & Code question

I have a workbook with a Master and Summary sheet.
It will become a Template, (or perhaps read only xls).
Buttons on the Master allow the user to do simple things like add a sheet,
reorder sheets, etc.

When they add a sheet via the button on the Master, I'd like to copy a
hidden button from the Master, and place it on the new sheet (including the
code).

Can I do this, and if so, how, please?

Regards.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Copy Button & Code question

Easier to have the generalized code in a general module and use a button
from the forms toolbar. then you just add it (macro recorder) and assign
it to the macro. (OnAction property).

In the generalized code

Sub General_Button_Click()
sName = Application.Caller
btn = Activesheet.Buttons(sName)
msgbox btn.Caption
End Sub

Or
http://www.cpearson.com/excel/vbe.htm

and the macro recorder shows how to copy or add a commandbutton. (why
copy - just add it and format it as you wish with code).


--
Regards,
Tom Ogilvy

"Stuart" wrote in message
...
I have a workbook with a Master and Summary sheet.
It will become a Template, (or perhaps read only xls).
Buttons on the Master allow the user to do simple things like add a sheet,
reorder sheets, etc.

When they add a sheet via the button on the Master, I'd like to copy a
hidden button from the Master, and place it on the new sheet (including

the
code).

Can I do this, and if so, how, please?

Regards.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default Copy Button & Code question

Thanks for the code and guidance.

Regards.

"Tom Ogilvy" wrote in message
...
Easier to have the generalized code in a general module and use a button
from the forms toolbar. then you just add it (macro recorder) and assign
it to the macro. (OnAction property).

In the generalized code

Sub General_Button_Click()
sName = Application.Caller
btn = Activesheet.Buttons(sName)
msgbox btn.Caption
End Sub

Or
http://www.cpearson.com/excel/vbe.htm

and the macro recorder shows how to copy or add a commandbutton. (why
copy - just add it and format it as you wish with code).


--
Regards,
Tom Ogilvy

"Stuart" wrote in message
...
I have a workbook with a Master and Summary sheet.
It will become a Template, (or perhaps read only xls).
Buttons on the Master allow the user to do simple things like add a
sheet,
reorder sheets, etc.

When they add a sheet via the button on the Master, I'd like to copy a
hidden button from the Master, and place it on the new sheet (including

the
code).

Can I do this, and if so, how, please?

Regards.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code for my Command Button to automatically copy and insert a new tommy Excel Discussion (Misc queries) 0 January 28th 09 12:22 AM
Command Button Code to copy data sho Excel Programming 3 July 7th 04 01:53 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM
copy to sheet code question mlmkbr Excel Programming 0 March 4th 04 07:42 PM
Copy form and code question Stuart[_5_] Excel Programming 2 August 17th 03 12:38 PM


All times are GMT +1. The time now is 10:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"