LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Deleting veryHidden worksheets

Can a worksheet which is very hidden be deleted without being made visible
first?

I can manipulate a veryhidden sheet using an object variable, but I either
can't get the syntax right to delete it or there is some other problem
beyond my limited knowledge.

Can someone please shed some light on how to delete such sheets?

What I have tried so far:
(it fails with a message telling me that I cannot have duplicate names; if I
exit the routine after the Worksheets(WBSsht).Delete line, then the sheet is
still present under MS Objects.

Public WBSsht As Object
Option Explicit

Sub procMain()
Dim sh As Worksheet
Dim rngPlaceHolder As Range

'Add a blank worksheet but check it exists first
On Error Resume Next
Set WBSsht = Worksheets("WBSlist")
Set sh = WBSsht
If sh Is Nothing Then 'Doesn't exist
Set sh = Nothing
On Error GoTo 0

Else 'Does exist - delete it before proceeding
Set sh = Nothing

'Application.DisplayAlerts = False
Worksheets(WBSsht).Delete
'Application.DisplayAlerts = True
On Error GoTo 0
End If

Set WBSsht = Worksheets.Add

'and give it a name
WBSsht.Name = ("WBSlist")

Worksheets("WBSlist").Visible = xlVeryHidden
End Sub



 
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
Please help me find veryhidden sheets J.W. Aldridge Excel Programming 1 September 26th 07 03:25 PM
VeryHidden causing a problem...? Darin Kramer Excel Programming 0 April 11th 07 04:54 PM
VeryHidden Darin Kramer Excel Programming 2 September 13th 05 05:30 PM
Sheet hidden and VeryHidden Marc Excel Discussion (Misc queries) 6 March 29th 05 12:33 AM
Problems with vb.veryhidden Dumbass[_2_] Excel Programming 2 July 20th 04 05:08 AM


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