Thread: Grouped Sheets
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Steph Steph is offline
external usenet poster
 
Posts: 110
Default Grouped Sheets

Thank you - works great!

--
Steph


"Rick Rothstein" wrote:

This slightly simpler coding appears to work as well as my previously posted
function...

Function IsSheetGrouped(SheetName As String) As Boolean
On Error Resume Next
IsSheetGrouped = ActiveWindow.SelectedSheets(SheetName).Index
End Function

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
You can use this function to test whether any specific sheet is in a
group...

Function IsSheetGrouped(SheetName) As Boolean
On Error Resume Next
IsSheetGrouped = StrComp(ActiveWindow.SelectedSheets(SheetName). _
Name, SheetName, vbTextCompare) = 0
End Function

Using this function, you would do your test like this...

If IsSheetGrouped(ActiveSheet.Name) Then
' Yes, it is grouped
Else
' No, it is not grouped
End If

--
Rick (MVP - Excel)


"Steph" wrote in message
...
Is there a way to check for and/or display an error message in VBA if the
active sheet is grouped with another sheet?

Thanks for your help.

--
Steph