Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default copy a command button to new worksheet

Hello,

Does anyone knows how to copy a command button to new worksheet?

I am a beginner and want to do things more effective, cos I have to
fill in different information in the same template but split across the
sheet.

eg.

I create a template in Sheet A and I have asign a macro (to copy the
whole sheet and insert a new sheet) to a command button.

Private Sub test()
Cells.Select
Selection.Copy
Sheets("Sheet1").Select
Sheets.Add
ActiveSheet.Paste
End Sub

When I click on that command button in sheet A, it will copy the whole
sheet A to a new sheet.

However the command button is not on the new sheet. (but still)

Is there a way to copy and paste the command button too, so that there
will always be a command button in the new sheet?

Thanks.

Elaine.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default copy a command button to new worksheet

On 22 Jun 2006 07:52:52 -0700, elaine wrote:

[..].
I create a template in Sheet A and I have asign a macro (to copy the
whole sheet and insert a new sheet) to a command button.

[...]
Is there a way to copy and paste the command button too, so that there
will always be a command button in the new sheet?


Can't you just use the same button again?
Copying a button requires copying associated VBA code as well. This is
quite bad idea.

If you need some universal button (available all the time, on every sheet),
try to put it on a user form, not on a sheet.

--
PL
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default copy a command button to new worksheet

Hi Piotor,

Given Elaine's shown macro and the phrase "and I have asign a macro", I
assume that the button in question is a Forms button.

---
Regards,
Norman



"Piotr Lipski" wrote in
message ...
On 22 Jun 2006 07:52:52 -0700, elaine wrote:

[..].
I create a template in Sheet A and I have asign a macro (to copy the
whole sheet and insert a new sheet) to a command button.

[...]
Is there a way to copy and paste the command button too, so that there
will always be a command button in the new sheet?


Can't you just use the same button again?
Copying a button requires copying associated VBA code as well. This is
quite bad idea.

If you need some universal button (available all the time, on every
sheet),
try to put it on a user form, not on a sheet.

--
PL



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default copy a command button to new worksheet

Hi Elaine,

Try:

'=============
Public Sub Test()
Sheets("SheetA").Copy After:=Sheets(Sheets.Count)
End Sub
'<<=============



---
Regards,
Norman



"elaine" wrote in message
ups.com...
Hello,

Does anyone knows how to copy a command button to new worksheet?

I am a beginner and want to do things more effective, cos I have to
fill in different information in the same template but split across the
sheet.

eg.

I create a template in Sheet A and I have asign a macro (to copy the
whole sheet and insert a new sheet) to a command button.

Private Sub test()
Cells.Select
Selection.Copy
Sheets("Sheet1").Select
Sheets.Add
ActiveSheet.Paste
End Sub

When I click on that command button in sheet A, it will copy the whole
sheet A to a new sheet.

However the command button is not on the new sheet. (but still)

Is there a way to copy and paste the command button too, so that there
will always be a command button in the new sheet?

Thanks.

Elaine.



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
copy cell by command button kalpesh Excel Worksheet Functions 1 December 28th 11 08:41 PM
Command button copy array Noslien[_3_] Excel Programming 2 February 19th 06 10:04 PM
Using Command Button to copy cells Pennington Excel Discussion (Misc queries) 1 April 29th 05 02:30 AM
Copy down command button sowetoddid[_49_] Excel Programming 1 June 16th 04 03:48 PM
copy and delete command button Mark Kubicki Excel Programming 0 October 6th 03 08:20 PM


All times are GMT +1. The time now is 09:16 PM.

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

About Us

"It's about Microsoft Excel"