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 to an existing workbook - Microsoft Excel Tutorial
From the course: Excel VBA: Managing Files and Data
Copy a worksheet to an existing workbook
- [Instructor] One common task that you will perform using Excel VBA is to copy a worksheet from one workbook to another. And in this case, instead of copying to a new workbook, you will copy your worksheet to an existing workbook. I'll show you how to do that in this movie. My sample file is 03_05_CopyToExisting, and that's a macro enabled workbook you can find in the chapter three folder of your exercise files collection. This workbook contains three worksheets and we will copy one of them, but we don't need to work with the data, so I will press Alt + F11 to move over to the Visual Basic editor. In here, I have two procedures. The first is a sub-routine called CopyToExisting, and the second is a function. I'll talk about the function, which is at the bottom of the screen first. What it does is it checks whether a particular file is open or not. And the name of that file is given in the variable strFileName. And…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Check if a worksheet exists5m 11s
-
Create and rename worksheets5m 28s
-
(Locked)
Copy a worksheet within the active workbook4m 20s
-
(Locked)
Copy a worksheet to a new workbook3m 58s
-
(Locked)
Copy a worksheet to an existing workbook5m 47s
-
Move a worksheet within the active workbook3m 15s
-
(Locked)
Move a worksheet to a new workbook4m 41s
-
(Locked)
Move a worksheet to an existing workbook6m 24s
-
(Locked)
-
-
-
-
-