The information in this article applies to:
SUMMARY
In the versions of Microsoft Excel listed at the beginning of this article,
it is not possible to add a new sheet after the last sheet in the workbook
in a single action. For example, if you have a workbook that contains
Sheet1 and Sheet2 (in left-to-right sheet tab order), you cannot add a new
sheet to the right of Sheet2.
MORE INFORMATIONIf your application requires that a new sheet be added or inserted after the last sheet in the workbook, there are two ways that you can achieve this task:
-or- Visual Basic Code ExampleMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:http://www.microsoft.com/support/supportnet/overview/overview.aspThis sample Visual Basic code inserts a new sheet into a workbook and makes the new sheet become the last sheet in the workbook by moving it to the right of the rightmost sheet. This example assumes you have a workbook that contains at least one Visual Basic module and any number of other sheets. To run the example, position the cursor in the line that reads "Sub AddNewSheet()" and either press F5 or click Start on the Run menu.
When you run the AddNewSheet Sub procedure, it will add a new sheet to the
active workbook and make the new sheet become the last sheet in the
workbook.
If you try to add a new sheet after the last sheet in the workbook, all in a single action, you will receive the following error message: For example, the following command will return an error message:
because it attempts to add a new sheet after the last sheet in the
workbook.
Additional query words: XL7 XL5 5.0
Keywords : kbprg PgmOthr PgmHowto |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |