Microsoft KB Archive/127940

= 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.