Article ID: 288402 - Last Review: January 31, 2007 - Revision: 5.4 How to copy or move sheets by using VBA code in Excel for MacThis article was previously published under Q288402 On This PageSUMMARY
You can use Microsoft Visual Basic for Applications (VBA) code to copy or move sheets within a workbook or between workbooks. This is particularly useful if you want to move or copy many sheets, or if you want to make multiple copies of a sheet. This article provides samples of VBA code to accomplish these tasks. MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. Note In Microsoft Excel 2001 for Macintosh without Microsoft Office 2001 for Mac Service Release 1, you must place the code in a separate workbook from the sheets being copied. Excel 2001 for Macintosh had a problem when the VBA code that copies the sheets is in the same workbook as the sheets being copied. This problem is resolved with Service Release 1 for Microsoft Office 2001 for Mac. For additional informationabout this problem in Excel 2001 for Mac, click the following article number to view the article in the Microsoft Knowledge Base: 286266
(http://support.microsoft.com/kb/286266/
)
Excel hangs when you attempt to copy worksheet in same workbook
:Sample Code to Copy WorksheetsCopy a Specific Sheet in the Active WorkbookCopy a Specific Sheet in the Active Workbook Multiple TimesCopy the ActiveSheet Multiple TimesCopy All the Sheets in a Workbook OnceSample Code to Move WorksheetsMove Active Sheet to a New Position in WorkbookMove Active Sheet to Another WorkbookMove Multiple Sheets in ActiveWorkbook to Another WorkbookREFERENCESMicrosoft Excel X for Mac and later versionsFor more information about the Copy method, from the Visual Basic Editor, click Search Microsoft Visual Basic Help on the Help menu, type copy method, click Search, and then click to view "Copy Method." Three topics are listed. Pick the one that applies to worksheets.For more information about the Move method, from the Visual Basic Editor, click Search Microsoft Visual Basic Help on the Help menu, type move method, click Search, and then click to view "Move Method." Three topics are listed. Pick the one that applies to worksheets. Excel 2001 for MacintoshFor more information about the Copy method, from the Visual Basic Editor, click the Office Assistant, type copy method, click Search, and then click to view "Copy Method (MS Excel VBA)."For more information about the Move method, from the Visual Basic Editor, click the Office Assistant, type move method, click Search, and then click to view "Move Method (MS Excel VBA)." For additional information about problems with copying worksheets that contain code in the same workbook, click the article number below to view the article in the Microsoft Knowledge Base: 286266
(http://support.microsoft.com/kb/286266/EN-US/
)
XL2001: Excel Hangs When You Attempt to Copy Worksheet in Same Workbook
Microsoft Excel 98 Macintosh EditionFor more information about the Copy method, from the Visual Basic Editor, click the Office Assistant, type copy method, click Search, and then click to view "Copy Method (Excel 97)."For more information about the Move method, from the Visual Basic Editor, click the Office Assistant, type move method, click Search, and then click to view "Move Method (Excel 97)." | Article Translations
|
Back to the top
