PC Review


Reply
Thread Tools Rate Thread

Addings sheets using Macro

 
 
rob
Guest
Posts: n/a
 
      9th Jan 2009
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 before:=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?
 
Reply With Quote
 
 
 
 
S Davis
Guest
Posts: n/a
 
      9th Jan 2009
On Jan 9, 11:47*am, rob <r...@discussions.microsoft.com> 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 before:=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 With Quote
 
rob
Guest
Posts: n/a
 
      9th Jan 2009
S. I'm running 2003

"S Davis" wrote:

> On Jan 9, 11:47 am, rob <r...@discussions.microsoft.com> 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 before:=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 With Quote
 
Tony Zappal
Guest
Posts: n/a
 
      9th Jan 2009
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 <r...@discussions.microsoft.com> 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 before:=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 With Quote
 
rob
Guest
Posts: n/a
 
      9th Jan 2009
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 <r...@discussions.microsoft.com> 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 before:=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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Addings records to a query Chad Microsoft Access Macros 5 27th Oct 2008 04:31 AM
addings lots of pictures to a webpage rmathew84@gmail.com Microsoft Frontpage 2 29th Jun 2007 12:02 AM
"With Sheets" Issue - macro on one sheet to affect hidden rows on other sheets Punsterr Microsoft Excel Programming 3 21st Feb 2006 04:01 AM
Macro for filter on protected workbook that works for all sheets, no matter what sheets are named? StargateFanFromWork Microsoft Excel Programming 6 26th Jan 2006 06:31 PM
macro visibility in auto loaded macro sheets? =?Utf-8?B?Z2hvc3RXb2xm?= Microsoft Excel Misc 1 29th Jun 2004 08:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:03 AM.