Chris The Rock
Active Member
- Joined
- Feb 24, 2002
- Messages
- 287
In my workbook, I have a couple of hidden sheets.
During my code, I am copying one of those sheets, and by the following code, attempting to place it as the last sheet in the workbook, and then make the new sheet visible. I'm using the sheet's CodeName property to identify it.
The problem is - the new copy of the sheet is not being added as the last sheet. It is being added immediately after the sheet that's being copied. This causes a chain reaction of problems in the rest of my code, where the newest sheet is expected to be the last one in the workbook.
In a new workbook, I cannot reproduce the problem. Also, if I unhide my hidden sheets, it works fine.
Any ideas? Is this a known bug?
During my code, I am copying one of those sheets, and by the following code, attempting to place it as the last sheet in the workbook, and then make the new sheet visible. I'm using the sheet's CodeName property to identify it.
Code:
MYSHEET.Copy after:=Sheets(Sheets.Count)
Sheets(Sheets.count).Visible = True
The problem is - the new copy of the sheet is not being added as the last sheet. It is being added immediately after the sheet that's being copied. This causes a chain reaction of problems in the rest of my code, where the newest sheet is expected to be the last one in the workbook.
In a new workbook, I cannot reproduce the problem. Also, if I unhide my hidden sheets, it works fine.
Any ideas? Is this a known bug?