Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Deleting Worksheet Error

I am running through a loop and create/add a worksheet (sheet #1).
After placing all of the data on sheet #1 a second sheet (sheet #2) is
created/added and formulas are set on sheet #2 to read from sheet #1. The
calcs on sheet #2 are then copied and pasted as values, then I try to delete
sheet #1. When the activesheet.delete command is executed I get a "Cant read
memory error" and Excel is shut down.

How can I delete my newly created sheet without creating a catastrophic error?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Deleting Worksheet Error

Hi James,

Post the problematic code.


---
Regards,
Norman



"James McDowell" wrote in message
...
I am running through a loop and create/add a worksheet (sheet #1).
After placing all of the data on sheet #1 a second sheet (sheet #2) is
created/added and formulas are set on sheet #2 to read from sheet #1. The
calcs on sheet #2 are then copied and pasted as values, then I try to
delete
sheet #1. When the activesheet.delete command is executed I get a "Cant
read
memory error" and Excel is shut down.

How can I delete my newly created sheet without creating a catastrophic
error?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Deleting Worksheet Error

For Each wn In ActiveWorkbook.Sheets
If Right(wn.Name, 5) = "-DATA" Then
wn.Delete
End If
Next 'wn

Is there an inherent bug that you can not delete a worksheet created in code
until a certain condition is met?

"James McDowell" wrote:

I am running through a loop and create/add a worksheet (sheet #1).
After placing all of the data on sheet #1 a second sheet (sheet #2) is
created/added and formulas are set on sheet #2 to read from sheet #1. The
calcs on sheet #2 are then copied and pasted as values, then I try to delete
sheet #1. When the activesheet.delete command is executed I get a "Cant read
memory error" and Excel is shut down.

How can I delete my newly created sheet without creating a catastrophic error?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Deleting Worksheet Error

Hi James,

The section of code you show is unexceptionable and I see no reason why it
might cause you problem.

Any code problem that there might be is likely to be upstream of this
section.

Is your problem reproducible, i.e. if you run the same code on another
workbook does the problem recur?

How can I delete my newly created sheet without creating a catastrophic
error?


Have you tried copy sheet # 2, and any other sheets, to another workbook and
then trashing the original workbook?


---
Regards,
Norman



"James McDowell" wrote in message
...
For Each wn In ActiveWorkbook.Sheets
If Right(wn.Name, 5) = "-DATA" Then
wn.Delete
End If
Next 'wn

Is there an inherent bug that you can not delete a worksheet created in
code
until a certain condition is met?

"James McDowell" wrote:

I am running through a loop and create/add a worksheet (sheet #1).
After placing all of the data on sheet #1 a second sheet (sheet #2) is
created/added and formulas are set on sheet #2 to read from sheet #1.
The
calcs on sheet #2 are then copied and pasted as values, then I try to
delete
sheet #1. When the activesheet.delete command is executed I get a "Cant
read
memory error" and Excel is shut down.

How can I delete my newly created sheet without creating a catastrophic
error?



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
Deleting a worksheet but retaining values from the worksheet. [email protected] Excel Discussion (Misc queries) 1 September 13th 06 03:00 PM
Deleting a worksheet but retaining values from the worksheet. [email protected] Excel Discussion (Misc queries) 1 September 13th 06 02:48 PM
deleting values in a worksheet without deleting the formulas patti Excel Worksheet Functions 1 October 28th 05 09:49 PM
Error when deleting sheets John Excel Programming 5 July 7th 05 07:27 PM
error runtime 9: deleting a worksheet [email protected] Excel Programming 4 April 7th 05 04:42 PM


All times are GMT +1. The time now is 05:39 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"