XL97: Cannot Move or Copy Sheet After Last Sheet (143458)
The information in this article applies to:
- Microsoft Excel 97 for Windows
This article was previously published under Q143458 SYMPTOMS
When you run a Microsoft Visual Basic for Applications macro that copies or
moves a worksheet or a chart sheet after the last worksheet in the
workbook, or if you attempt to do this manually, Microsoft Excel does not
insert the copied or moved worksheet after the last worksheet in the
workbook.
CAUSE
This behavior occurs when the last worksheet in the workbook is hidden.
This behavior is by design of Microsoft Excel.
WORKAROUNDMicrosoft 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 a Microsoft Certified Partner or the Microsoft fee-based
consulting line at (800) 936-5200. For more information about Microsoft Certified
Partners, please visit the following Microsoft Web site:
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
To prevent this behavior from occurring, move all hidden sheets to the
front in the order of sheet tabs in the workbook. To do this manually,
unhide all hidden sheets, drag the sheet tabs to the left (in front of the
other tabs), and then rehide the sheets.
To unhide a sheet, follow these steps:
- On the Format menu, point to Sheet, and then click Unhide.
- Click the name of the sheet you want to unhide and click OK.
To hide a sheet, follow these steps:
- Activate the sheet.
- On the Format menu, point to Sheet, and click Hide.
Alternatively, you can use the following Visual Basic for Applications
macro to move all hidden sheets to the beginning of the workbook:
Sub MoveHiddenSheets()
For Each xSheet In ActiveWorkbook.Sheets
If xSheet.Visible = False Then
xSheet.Move Before:=Sheets(1)
End If
Next xSheet
End Sub
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbdtacode kbprb KB143458 |
---|
|