Thread: Corruption?
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Mike Preston Mike Preston is offline
external usenet poster
 
Posts: 8
Default Corruption?

On Tue, 2 Sep 2003 13:17:27 +0100, "Charles Williams"
wrote:

I would also change your code to prevent possible problems with dialog
sheets and chart sheets etc: currently you are using the count of the
worksheets collection (worksheets only) but referring to the sheets
collection (all types of sheet).


Good point, although making them consistent doesn't change the abend.

mike


Public Function ShowItAll() as Boolean

For i = 1 To Worksheets.Count
WorkSheets(i).Visible = True
Next i
ShowItAll = True
End Function


HTH
Charles
______________________
Decision Models
The Excel Calculation Site
www.DecisionModels.com

"Tom Ogilvy" wrote in message
...
Since you are unhiding sheets and it fails on the same sheet each time

(the
10th sheet), then it might be an indication there is some corruption in

your
workbook. You might try skipping over the 10th sheet and unhide the rest,
then copy them to a new workbook and create a new 10th sheet.

Public Function ShowItAll() as Boolean
For i = 1 To Worksheets.Count
if i < 10 then _
Sheets(i).Visible = True
Next i
ShowItAll = True
End Function

Regards,
Tom Ogilvy

"Richard Daniels" wrote in message
...
Hi Mike

There is nothing wrong with you code, it's just that you
cannot hide all the worksheets. You must have at least 1
visable sheet.


-----Original Message-----
Can I assume that if I abend when running the following
public
function that I have some form of corruption in my
workbook? If so,
any suggestions as to the best way to create a workbook
without
corruption?

Public Function ShowItAll() as Boolean

For i = 1 To Worksheets.Count
Sheets(i).Visible = True
Next i
ShowItAll = True
End Function

The line "Sheets(i).Visible = True" consistently gives
me an error
that Excel needs to shut down after the 9th and before
the 10th
worksheet in the workbook is set to visible.

Thanks

mike


.