Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
List Sheets excluding sheets named ***-A | Excel Discussion (Misc queries) | |||
Excluding VAT for selected item | Excel Worksheet Functions | |||
Excluding selected cells in excel | Excel Discussion (Misc queries) | |||
Copy range excluding group data | Excel Programming | |||
Copy range excluding group data | Excel Programming |