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

I have a userform that allows a user to Save individual worksheets from a
workbook. To make this happen, I had to write a macro to copy the individual
worksheet to new workbook, and then have the Save As dialog box appear. When
I copy the sheet, the Command Buttons are also copied. Is there a way to
eliminate the buttons from being copied?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200604/1
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Copy Button Problem

one way would be to create a new workbook and then copy and paste the cells

dim sh as worksheet, bk as workbook
set sh = activesheet
set bk = workbooks.Add
sh.cells.copy destination:=bk.Worksheets(1).cells

then you won't copy any code associated with the commandbuttons either.

--
Regards,
Tom Ogilvy

"mtm4300 via OfficeKB.com" wrote:

I have a userform that allows a user to Save individual worksheets from a
workbook. To make this happen, I had to write a macro to copy the individual
worksheet to new workbook, and then have the Save As dialog box appear. When
I copy the sheet, the Command Buttons are also copied. Is there a way to
eliminate the buttons from being copied?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200604/1

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Copy Button Problem

Thank you Tom. That is awesome.

One other quick question, and I know this probably very simple. Is there
anyway to make a certain cell active on the copied worksheet? I cannot put
Range(C2).Select in the original workbook because it is the active workbook.
And I cannot put that code in the copied worksheet because it has not been
created yet.

Tom Ogilvy wrote:
one way would be to create a new workbook and then copy and paste the cells

dim sh as worksheet, bk as workbook
set sh = activesheet
set bk = workbooks.Add
sh.cells.copy destination:=bk.Worksheets(1).cells

then you won't copy any code associated with the commandbuttons either.

I have a userform that allows a user to Save individual worksheets from a
workbook. To make this happen, I had to write a macro to copy the individual
worksheet to new workbook, and then have the Save As dialog box appear. When
I copy the sheet, the Command Buttons are also copied. Is there a way to
eliminate the buttons from being copied?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200604/1
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Copy Button Problem

In the context of the code I provided

dim sh as worksheet, bk as workbook
set sh = activesheet
set bk = workbooks.Add
sh.cells.copy destination:=bk.Worksheets(1).cells
sh.Range("C2").Select

Realistically, You can only select on the activesheet. When you copy a
sheet or add a workbook or add a sheet, it is the activesheet until you
change it.

--
Regards,
Tom Ogilvy


"mtm4300 via OfficeKB.com" wrote:

Thank you Tom. That is awesome.

One other quick question, and I know this probably very simple. Is there
anyway to make a certain cell active on the copied worksheet? I cannot put
Range(C2).Select in the original workbook because it is the active workbook.
And I cannot put that code in the copied worksheet because it has not been
created yet.

Tom Ogilvy wrote:
one way would be to create a new workbook and then copy and paste the cells

dim sh as worksheet, bk as workbook
set sh = activesheet
set bk = workbooks.Add
sh.cells.copy destination:=bk.Worksheets(1).cells

then you won't copy any code associated with the commandbuttons either.

I have a userform that allows a user to Save individual worksheets from a
workbook. To make this happen, I had to write a macro to copy the individual
worksheet to new workbook, and then have the Save As dialog box appear. When
I copy the sheet, the Command Buttons are also copied. Is there a way to
eliminate the buttons from being copied?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200604/1

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
add or copy a sheet by button ghost Excel Discussion (Misc queries) 1 February 20th 08 10:42 PM
Copy into Row holding Button nejlangton Excel Programming 2 September 2nd 04 01:25 PM
Copy down command button sowetoddid[_49_] Excel Programming 1 June 16th 04 03:48 PM
Copy Button with worksheet S. S. Excel Programming 1 December 4th 03 05:42 PM
Copy button images raj Excel Programming 1 November 6th 03 04:27 PM


All times are GMT +1. The time now is 05:35 AM.

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"