Microsoft Knowledge Base

VB for Applications Worksheets Move Method with Hidden Sheet

Last reviewed: September 13, 1996
Article ID: Q127940
The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for the Macintosh, versions 5.0, 5.0a
  • Microsoft Excel for Windows 95, versions 7.0, 7.0a
  • Microsoft Excel for Windows NT, version 5.0

SYMPTOMS

If you attempt to use the following code in a workbook where you have hidden sheets, you will receive unexpected results:

   ActiveSheet.Move before:=Sheets("sheet name")

CAUSE

If there are any hidden sheets in your workbook that are located before the sheet that you are trying to move in front of, the move method will actually move the active sheet behind your destination worksheet.

WORKAROUND

If you have hidden sheets in your workbook and you are going to be moving your sheets using Visual Basic for Applications code, you will need to locate all of your hidden sheets at the very end of your workbook. This problem only occurs when there are hidden sheets in front of your destination sheets.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post more information here in the Microsoft Knowledge Base as it becomes available.


KBCategory: kbprg kbcode
KBSubcategory:

Additional reference words: 5.00 7.00



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 13, 1996
©1997 Microsoft Corporation. All rights reserved. Legal Notices.