Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Grouped Sheets
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Grouped Sheets
Use this line of code to determine how many sheets are currently selected...
ActiveWindow.SelectedSheets.Count -- HTH... Jim Thomlinson "Steph" wrote: 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Grouped Sheets
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Grouped Sheets
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Paste into grouped sheets using VB | Excel Worksheet Functions | |||
Replace with Grouped Sheets | Excel Discussion (Misc queries) | |||
Grouped Sheets and Formating | Excel Discussion (Misc queries) | |||
Printing Grouped Sheets | Excel Programming | |||
Printing Grouped Sheets | Excel Programming |