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 an existing workbook

Move a worksheet to an existing workbook - Microsoft Excel Tutorial

From the course: Excel VBA: Managing Files and Data

Start my 1-month free trial

Move a worksheet to an existing workbook

- [Instructor] In the previous movie, I showed you how to move, that is cut and paste, a worksheet from one workbook to a new workbook. In this movie, I will show you how to move a worksheet to an existing workbook. My sample file is 0308 move to existing, and that's a macro enabled workbook you can find in the chapter three folder of the exercise files collection. This workbook contains three worksheets, and I won't work with any of their data. So I'll just press alt F11 to move to the visual basic editor. And here I have two procedures, a sub-routine at the top and a function at the bottom. I'll take a look at the function first because it's used as part of the sub-routine. So this function is called check if open and it accepts a file name as a string and it returns this output as a Boolean variable. So that means it is either true or false. It can only take on one of two values. The code is very clever, and…

Contents