Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Excluding sheet from group of selected sheets

Hi all
Have got this far

Dim sGroupedWS() As String
Dim lGroupedWSCount As Long
Dim lCounter As Long
lGroupedWSCount = ActiveWindow.SelectedSheets.Count
For lCounter = 1 To lGroupedWSCount
sGroupedWS(lCounter) = ActiveWindow.SelectedSheets(lCounter).Name
Next lCounter

Problem:
First I want to check whether the worksheet "HELP" is the only selected
sheet and if it is then exit sub.
Assuming that "HELP" is not the only selected sheet (and it may not even be
selected at all) then I want to exclude the worksheet "HELP" from the group
of selected sheets, ie unselect that particular sheet but otherwise leave
the selected sheets unchanged. If "HELP" was the activesheet then I do not
really care what sheet becomes the activesheet when "HELP" is unselected.

Overall intention is this (and there may be a better approach than the
above)
The macro deletes the selected sheets, which may be a group of selected
sheets. The only restriction that I wish to impose is that the worksheet
"HELP" must NOT be deleted if it is included in the group of selected sheets
(and it may not be included).

Any help gratefully received.

--
Return email address is not as DEEP as it appears


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default Excluding sheet from group of selected sheets

Hi Jack,

The macro deletes the selected sheets, which may be a group of selected
sheets. The only restriction that I wish to impose is that the worksheet
"HELP" must NOT be deleted if it is included in the group of selected sheets
(and it may not be included).


Like this maybe:

Dim oSh as Object
Application.DisplayAlerts=False
For Each oSh in Activewindow.SelectedSheets
If oSh.Name<"HELP" Then
oSh.Delete
End If
Next
Application.DisplayAlerts=True

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com

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
List Sheets excluding sheets named ***-A Dolphinv4 Excel Discussion (Misc queries) 1 December 15th 07 09:29 AM
Excluding VAT for selected item triffidbook Excel Worksheet Functions 4 September 7th 06 08:20 AM
Excluding selected cells in excel Farhad Excel Discussion (Misc queries) 3 May 29th 06 08:45 PM
Copy range excluding group data gavmer[_74_] Excel Programming 0 September 19th 04 11:55 PM
Copy range excluding group data gavmer[_73_] Excel Programming 1 September 17th 04 02:30 PM


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