Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Copying Worksheet to New Workbook

I need a macro to copy a certain sheet to a new workbook, unprotect the
sheet, and copy and paste the values in the new worksheet as values (Paste
Special). The one problem I am having is the first step: copying the sheet to
a new workbook. If you can give me some sample code for this whole process,
that would be great. I would more than likely use a Command Button from the
Control Toolbox on another sheet so that when I email the new workbook, there
are no macros in it.

Thanks in advance.
--
I am running on Excel 2003, unless otherwise stated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Copying Worksheet to New Workbook

Hi Orion

See
http://www.rondebruin.nl/mail/folder1/mail2.htm

Add this before the commented code that make the values
and remove the ' for every commented line

Looks like this then

Destwb.Sheets(1).Unprotect "password"

' 'Change all cells in the worksheet to values if you want
With Destwb.Sheets(1).UsedRange
.Cells.Copy
.Cells.PasteSpecial xlPasteValues
.Cells(1).Select
End With
Application.CutCopyMode = False




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Orion Cochrane" wrote in message
...
I need a macro to copy a certain sheet to a new workbook, unprotect the
sheet, and copy and paste the values in the new worksheet as values (Paste
Special). The one problem I am having is the first step: copying the sheet to
a new workbook. If you can give me some sample code for this whole process,
that would be great. I would more than likely use a Command Button from the
Control Toolbox on another sheet so that when I email the new workbook, there
are no macros in it.

Thanks in advance.
--
I am running on Excel 2003, unless otherwise stated.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Copying Worksheet to New Workbook

Thanks, Ron. I should have stated that I manually email the workbook because
I have Yahoo! Mail at home. I just need a macro to copy the sheet to a new
workbook. I'll take the code you gave me in this post and stick it at the
end. Thanks again.
--
I am running on Excel 2003, unless otherwise stated.


"Ron de Bruin" wrote:

Hi Orion

See
http://www.rondebruin.nl/mail/folder1/mail2.htm

Add this before the commented code that make the values
and remove the ' for every commented line

Looks like this then

Destwb.Sheets(1).Unprotect "password"

' 'Change all cells in the worksheet to values if you want
With Destwb.Sheets(1).UsedRange
.Cells.Copy
.Cells.PasteSpecial xlPasteValues
.Cells(1).Select
End With
Application.CutCopyMode = False




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Orion Cochrane" wrote in message
...
I need a macro to copy a certain sheet to a new workbook, unprotect the
sheet, and copy and paste the values in the new worksheet as values (Paste
Special). The one problem I am having is the first step: copying the sheet to
a new workbook. If you can give me some sample code for this whole process,
that would be great. I would more than likely use a Command Button from the
Control Toolbox on another sheet so that when I email the new workbook, there
are no macros in it.

Thanks in advance.
--
I am running on Excel 2003, unless otherwise stated.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default Copying Worksheet to New Workbook

I see the macro I need. Thanks. I'll have to get back to you later to test it
at home.
--
I am running on Excel 2003, unless otherwise stated.


"Orion Cochrane" wrote:

Thanks, Ron. I should have stated that I manually email the workbook because
I have Yahoo! Mail at home. I just need a macro to copy the sheet to a new
workbook. I'll take the code you gave me in this post and stick it at the
end. Thanks again.
--
I am running on Excel 2003, unless otherwise stated.


"Ron de Bruin" wrote:

Hi Orion

See
http://www.rondebruin.nl/mail/folder1/mail2.htm

Add this before the commented code that make the values
and remove the ' for every commented line

Looks like this then

Destwb.Sheets(1).Unprotect "password"

' 'Change all cells in the worksheet to values if you want
With Destwb.Sheets(1).UsedRange
.Cells.Copy
.Cells.PasteSpecial xlPasteValues
.Cells(1).Select
End With
Application.CutCopyMode = False




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Orion Cochrane" wrote in message
...
I need a macro to copy a certain sheet to a new workbook, unprotect the
sheet, and copy and paste the values in the new worksheet as values (Paste
Special). The one problem I am having is the first step: copying the sheet to
a new workbook. If you can give me some sample code for this whole process,
that would be great. I would more than likely use a Command Button from the
Control Toolbox on another sheet so that when I email the new workbook, there
are no macros in it.

Thanks in advance.
--
I am running on Excel 2003, unless otherwise stated.



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
Copying worksheet to another workbook Dig Excel Worksheet Functions 3 October 30th 08 09:01 PM
Copying Worksheet to new workbook with VBA Barb Reinhardt Excel Programming 1 July 3rd 08 07:11 PM
Copying a worksheet into the same workbook Michael New Users to Excel 9 February 6th 06 08:35 PM
Copying A Worksheet From Each Open Workbook to an new Workbook carl Excel Worksheet Functions 1 January 3rd 06 05:37 PM
Copying worksheet to another workbook Haider Quazilbash Excel Programming 2 September 22nd 03 06:23 PM


All times are GMT +1. The time now is 03:16 AM.

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"