Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Addings sheets using Macro

I have created a macro to add a number of sheets.
But every time when I want to add the 14th sheet, I receive a 1004 error.
The macro is very simple:
for i = 1 to 20
Sheets("Default").Copy befo=Sheets(2)
next i

In order to do so, I copy a template sheet.

What is wrong?
It looks like a stack overflow?
Do I have to reset some parameters?

I cannot even add a sheet manually after this error.
When I save and re-open I can again add sheets upto 14.
So it is not the total number of sheets that gives me the problem.

Any help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Addings sheets using Macro

On Jan 9, 11:47*am, rob wrote:
I have created a macro to add a number of sheets.
But every time when I want to add the 14th sheet, I receive a 1004 error.
The macro is very simple:
for i = 1 to 20
* * * *Sheets("Default").Copy befo=Sheets(2)
next i

In order to do so, I copy a template sheet.

What is wrong?
It looks like a stack overflow?
Do I have to reset some parameters?

I cannot even add a sheet manually after this error.
When I save and re-open I can again add sheets upto 14.
So it is not the total number of sheets that gives me the problem.

Any help?


Hmm. Works fine for me in 2003. What version of excel are you running?
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Addings sheets using Macro

S. I'm running 2003

"S Davis" wrote:

On Jan 9, 11:47 am, rob wrote:
I have created a macro to add a number of sheets.
But every time when I want to add the 14th sheet, I receive a 1004 error.
The macro is very simple:
for i = 1 to 20
Sheets("Default").Copy befo=Sheets(2)
next i

In order to do so, I copy a template sheet.

What is wrong?
It looks like a stack overflow?
Do I have to reset some parameters?

I cannot even add a sheet manually after this error.
When I save and re-open I can again add sheets upto 14.
So it is not the total number of sheets that gives me the problem.

Any help?


Hmm. Works fine for me in 2003. What version of excel are you running?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Addings sheets using Macro

Hi,
It may be you are running into the cell format issue.
If your copying a template sheet which has alot of formatting on it, you may
be hitting the format limit.
You could try removing alot of the formatting from the template and test
again and see if you get more than 14 sheets.

Cheers,
Tony.

"rob" wrote:

S. I'm running 2003

"S Davis" wrote:

On Jan 9, 11:47 am, rob wrote:
I have created a macro to add a number of sheets.
But every time when I want to add the 14th sheet, I receive a 1004 error.
The macro is very simple:
for i = 1 to 20
Sheets("Default").Copy befo=Sheets(2)
next i

In order to do so, I copy a template sheet.

What is wrong?
It looks like a stack overflow?
Do I have to reset some parameters?

I cannot even add a sheet manually after this error.
When I save and re-open I can again add sheets upto 14.
So it is not the total number of sheets that gives me the problem.

Any help?


Hmm. Works fine for me in 2003. What version of excel are you running?

  #5   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Addings sheets using Macro

Indeed, if a remove other sheets etc and data, I can run unto 79 sheets.
I need the formatting.

is there a work around different from .save and .open ( resets somewhere
the memory, but I cannot save the document at that moment)

"Tony Zappal" wrote:

Hi,
It may be you are running into the cell format issue.
If your copying a template sheet which has alot of formatting on it, you may
be hitting the format limit.
You could try removing alot of the formatting from the template and test
again and see if you get more than 14 sheets.

Cheers,
Tony.

"rob" wrote:

S. I'm running 2003

"S Davis" wrote:

On Jan 9, 11:47 am, rob wrote:
I have created a macro to add a number of sheets.
But every time when I want to add the 14th sheet, I receive a 1004 error.
The macro is very simple:
for i = 1 to 20
Sheets("Default").Copy befo=Sheets(2)
next i

In order to do so, I copy a template sheet.

What is wrong?
It looks like a stack overflow?
Do I have to reset some parameters?

I cannot even add a sheet manually after this error.
When I save and re-open I can again add sheets upto 14.
So it is not the total number of sheets that gives me the problem.

Any help?

Hmm. Works fine for me in 2003. What version of excel are you running?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run macro on all sheets trey1982 Excel Worksheet Functions 3 April 7th 09 03:07 AM
Use same macro on 2 sheets? Dave B[_10_] Excel Programming 6 November 30th 06 10:46 PM
sheets macro ina Excel Programming 2 May 4th 06 04:47 PM
"With Sheets" Issue - macro on one sheet to affect hidden rows on other sheets Punsterr Excel Programming 3 February 21st 06 04:01 AM
Macro for filter on protected workbook that works for all sheets, no matter what sheets are named? StargateFanFromWork[_3_] Excel Programming 6 January 26th 06 06:31 PM


All times are GMT +1. The time now is 06:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"