• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Moving Completed Worksheets to Brand New Workbook

PipBoy808

Member
Hi,

I've written a macro that imports data from a master spreadsheet into a second workbook. This workbook is then shared with entities outside the organisation for which I work.

The data is imported to worksheet1. There's a static worksheet of unchanging contact data we'll call worksheet2, and there's a third worksheet containing buttons that activate the import macro and cells that contain important filepaths called workbook3.

It wouldn't be wise to allow third parties to view the third worksheet containing macros and filepaths. So, I'm wondering if there's code I can use that will copy worksheet1 and worksheet 2 to a new workbook once the import is complete, without copying the code.

Thanking you in advance!​
 
Hi Pip

Try this;

Code:
Sub MoveData()
    Sheets([{"Worksheet1", "Worksheet2"}]).Move
    ThisWorkbook.SaveAs "C:\Users\HYMC\NothingtoIt.xls"
End Sub

Change path to suit, make sure sheet names match.

Take care

Smallman
 
Back
Top