Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting a worksheet but retaining values from the worksheet. | Excel Discussion (Misc queries) | |||
Deleting a worksheet but retaining values from the worksheet. | Excel Discussion (Misc queries) | |||
deleting values in a worksheet without deleting the formulas | Excel Worksheet Functions | |||
Error when deleting sheets | Excel Programming | |||
error runtime 9: deleting a worksheet | Excel Programming |