VBA: maximum number of sheets

gio123bg

Active Member
Joined
Feb 14, 2004
Messages
255
Hi,
I receive an error message when I'm creating multiple sheets with this code:

ActiveWorkbook.Sheets("Report").Copy _
After:=ActiveWorkbook.Sheets("Report")

The error message is:

Run-Time Error '1004'
Copy method of worksheet class failed.

This happens when I have copied 230 sheets. Is it a limit of the number of sheets generated or the limit is related to the size of the workbook?

I tried to execute this code into the loop but without success.
nsheets = nsheets + 1
If nsheets = 50 Then
ActiveWorkbook.Save
nsheets = 0
End If

Many thanks in advance for your kind help.

Regards,

Giovanni
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,215,440
Messages
6,124,882
Members
449,193
Latest member
PurplePlop

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top