PC Review


Reply
Thread Tools Rate Thread

Copying Worksheet to New Workbook

 
 
Orion Cochrane
Guest
Posts: n/a
 
      10th Nov 2008
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 With Quote
 
 
 
 
Ron de Bruin
Guest
Posts: n/a
 
      10th Nov 2008
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" <(E-Mail Removed)> wrote in message
news:4718BDAA-08F8-4109-BFEF-(E-Mail Removed)...
>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 With Quote
 
Orion Cochrane
Guest
Posts: n/a
 
      10th Nov 2008
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" <(E-Mail Removed)> wrote in message
> news:4718BDAA-08F8-4109-BFEF-(E-Mail Removed)...
> >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 With Quote
 
Orion Cochrane
Guest
Posts: n/a
 
      10th Nov 2008
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" <(E-Mail Removed)> wrote in message
> > news:4718BDAA-08F8-4109-BFEF-(E-Mail Removed)...
> > >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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying worksheet to another workbook Dig Microsoft Excel Worksheet Functions 3 30th Oct 2008 09:01 PM
Copying a worksheet to another workbook =?Utf-8?B?RHV0Y2g=?= Microsoft Excel Misc 6 10th Aug 2007 05:01 PM
Copying a worksheet into the same workbook =?Utf-8?B?TWljaGFlbA==?= Microsoft Excel New Users 9 6th Feb 2006 08:35 PM
Copying A Worksheet From Each Open Workbook to an new Workbook =?Utf-8?B?Y2FybA==?= Microsoft Excel Worksheet Functions 1 3rd Jan 2006 05:37 PM
Copying each worksheet in a new workbook Eric1701 Microsoft Excel Worksheet Functions 1 3rd Sep 2004 09:08 AM


Features
 

Advertising
 

Newsgroups
 


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