Copying Worksheet to New Workbook

O

Orion Cochrane

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.
 
R

Ron de Bruin

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
 
O

Orion Cochrane

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.
 
O

Orion Cochrane

I see the macro I need. Thanks. I'll have to get back to you later to test it
at home.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top