ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help Can not Copy Sheet but Can add a New Sheet!!! (https://www.excelbanter.com/excel-programming/392977-help-can-not-copy-sheet-but-can-add-new-sheet.html)

Clarence Jackson

Help Can not Copy Sheet but Can add a New Sheet!!!
 

I have a question Currently I have built a database and there is a user
entry form which basically allows people to add users to the database

this worksheet basically is a template and after thee user clicks save the
worksheet actually copies itself and renames itself based on Cell "A1" and
the orginal page is erased back to its beginning state of the template



Here is the code and where I get the Error

-Code worked fine for about first 60 user additions

-Now I get an run time error "1004" copy method or worksheet method
failed

- tried deleting a few users and trying code again worked fine

- also tried to insert a blank sheet which worked fine only promblem is when
i try to copy this sheet template when I have over lets say 60 Worksheets
in Workbook





Sheets("Add KOL Form").Select
Sheets("Add KOL Form").Copy after:=Sheets(Sheets.Count)

Sheets("Add KOL Form (2)").Select
Sheets("Add KOL Form (2)").name = Range("b4")

Range("b2:b2").Select
Selection.ClearContents



Call ButtonUpdate
Sheets("Add KOL Form").Select
Range("b4:b30").Select

Selection.ClearContents
Range("d14:30").Select
Selection.ClearContents



Jim Cone

Help Can not Copy Sheet but Can add a New Sheet!!!
 

Maybe...
"Copying Worksheet Programmatically Causes Run-Time Error 1004 in Excel"
http://support.microsoft.com/default...b;en-us;210684

And some useful advice...
http://www.cpearson.com/excel/newposte.htm
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Clarence Jackson"

wrote in message
I have a question Currently I have built a database and there is a user
entry form which basically allows people to add users to the database

this worksheet basically is a template and after thee user clicks save the
worksheet actually copies itself and renames itself based on Cell "A1" and
the orginal page is erased back to its beginning state of the template

Here is the code and where I get the Error

-Code worked fine for about first 60 user additions

-Now I get an run time error "1004" copy method or worksheet method
failed

- tried deleting a few users and trying code again worked fine

- also tried to insert a blank sheet which worked fine only promblem is when
i try to copy this sheet template when I have over lets say 60 Worksheets
in Workbook
Sheets("Add KOL Form").Select
Sheets("Add KOL Form").Copy after:=Sheets(Sheets.Count)

Sheets("Add KOL Form (2)").Select
Sheets("Add KOL Form (2)").name = Range("b4")

Range("b2:b2").Select
Selection.ClearContents
Call ButtonUpdate
Sheets("Add KOL Form").Select
Range("b4:b30").Select

Selection.ClearContents
Range("d14:30").Select
Selection.ClearContents


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com