Free Support Forum -

Worksheets.RemoveAt() throwing exception


as Worksheets.AddCopy() does not really copy all information over to the new sheet (styles, row size) and also does not set the splitter position for the new sheets correctly (splitter is on the far left), I thought I would set up a template to include the maximum number of Sheets to be generated. For those Excel files that do not require the maximum number of Sheets, I thought I would simply use Worksheets.RemoveAt() to remove those Sheets I no longer need.

However calling RemoveAt() gives me an Reference not Set exception.

Any help would be appreciated.


Kai Iske

Dear Kai,

In most cases, I don’t recommend to use RemoveAt method, because it will increase designer file size and decrease performance. AddCopy will be better. Could you send me the designer file and your sample code? So I can see what information is not copied.

Thank you very much.


I have sent you my designer file including a small test app. This will show you that Excel will display

a) error messages when opening the sheet
b) Splitter/Scroll positions are broken

This has been tested on Excel 2000