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.

Copy a worksheet within the active workbook

Copy a worksheet within the active workbook - Microsoft Excel Tutorial

From the course: Excel VBA: Managing Files and Data

Start my 1-month free trial

Copy a worksheet within the active workbook

- [Instructor] Excel VBA is a powerful tool for automating your workbooks. However, it is somewhat inflexible, and what that means is that when you create workbooks and worksheets that you can automate using Excel VBA, you need to maintain that structure, that is the name of the worksheets and the way that they're laid out, so that the code will work when you run it on new worksheets that you add. That means that you'll spend a lot of time copying worksheets within a workbook. I'll demonstrate how to do that in this movie. My sample file is 03_03_CopyWithin, 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 be working with the data for any of them. So I'll press alt+F11 to move to the Visual Basic Editor. And here I have a code module and a sub-routine that I've started called CopyWithin. So I will down-arrow…

Contents