From the course: Excel VBA: Managing Files and Data

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Move a worksheet to a new workbook

Move a worksheet to a new workbook - Microsoft Excel Tutorial

From the course: Excel VBA: Managing Files and Data

Start my 1-month free trial

Move a worksheet to a new workbook

- When you manage files in Excel VBA, there will be times when you want to cut a worksheet from a workbook and move it to a new workbook. In this movie, I will show you how to do that. My sample file is 0307, moved to new, and it's an Excel macro enabled workbook that you can find in the chapter three folder of the exercise files collection. I have three worksheets in this workbook and we'll be working with January. This is the one that is currently showing. I don't need to work with any of the data, so I'll press alt F11 to move to the visual basic editor. And you can see here that I have a code module open with the outline of a sub routine called move to new. So I'll press the down arrow twice and I can start adding my code. The code to move a worksheet, that is, cut it from one workbook and move it to another, is straightforward. All you need to do is select the worksheet and then tell it to move. So that first line…

Contents